Dear friends , please, I have code:
After HttpJob.Post(string,"") ESP module is
A) restarted, I see in terminal(in logs) this error:
B) I get from JobDone "NOK"
or
C) Everything is OK as I decribed only if I use row: ' Dim nr As String ="1234" ' when I use this row (declaration), then http request is FUNCTIONED perfectly
I am sending pic with complete error description (but I think, some informations described on pic are not important, because the reason why code is not functioned I am describing directly in the code)
what I am doing wrong, please?
Best regards
pppc
I am watching:
but I can not fing solution
B4X:
dim a() as byte
a=byteconvert.StringFromBytes(Queue.FirstItem)
Log(a) 'here I see the expected number, for example: 1234
gotoweb(a)
Sub gotoweb (a() As Byte) ' Sub gotoweb (a() As string) ' declaration "Sub gotoweb(a() as string)" is not functioned. I get the same error as with: a() as byte
Log(a) 'here I see the expected number, for example: 1234
Dim nr As String =a ' when i use this , then http request is not NOT FUNCTIONED
' Dim nr As String ="1234" ' but when I use this row (declaration), then http request is FUNCTIONED perfectly
HttpJob.Initialize("x")
Dim string() As Byte ="http://www.abc.com/go.php?a="
string=JoinBytes(Array(string,nr.getbytes)) 'NOT FUNCTIONED with Dim nr As String =a
'string=JoinBytes(Array(string,nr)) 'NOT FUNCTIONED with Dim nr As String =a
log(string) ' here I see "http://www.abc.com/go.php?a=1234" which is functioned in explorer, but it is not functioned in ESP (wth declaration: Dim nr As String =a)
HttpJob.AddHeader("Content-Type", "application/x-www-form-urlencoded")
HttpJob.Post(string,"")
End Sub
After HttpJob.Post(string,"") ESP module is
A) restarted, I see in terminal(in logs) this error:
orrst cause:4
wdt reset
B) I get from JobDone "NOK"
B4X:
If Job.JobName="x" Then
If Job.Success Then
Log("OK")
Else
Log("NOK")
Log("ErrorMessage: ", Job.ErrorMessage)
Log("Status: ", Job.Status)
Log(Job.Response)
End If
End If
but the address for demonstrating: http://www.abc.com/go.php?a=1234 in chrome explorer is functioned..JobName: x
NOK
ErrorMessage:
Status: 400
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>
or
C) Everything is OK as I decribed only if I use row: ' Dim nr As String ="1234" ' when I use this row (declaration), then http request is FUNCTIONED perfectly
I am sending pic with complete error description (but I think, some informations described on pic are not important, because the reason why code is not functioned I am describing directly in the code)
what I am doing wrong, please?
Best regards
pppc
I am watching:
[module] rHttpUtils2 - Http Client
The HttpJob module implements an http client. It is a simplified version of B4X HttpUtils2. Example: Sub Process_Globals Public Serial1 As Serial Private wifi As ESP8266WiFi End Sub Private Sub AppStart Serial1.Initialize(115200) Log("AppStart") If wifi.Connect("dlink") Then...
www.b4x.com
Strings and Bytes
B4R strings are different than in other B4X tools. The reasons for these differences are: 1. Very limited memory. 2. Lack of Unicode encoders. A String object in B4R is the same as C char* string. It is an array of bytes with an additional zero byte at the end. The requirement of the last zero...
www.b4x.com
Attachments
Last edited: