HTTP function broken? Can't send long strings! -
linuxthefish - 13.11.2017
Hi,
I'm trying to send a long string using the HTTP function, and it ends up sending nothing at all.
My code:
pawn Code:
new result[1024];
format(result, 1024, "website.com/linuxthefish.php?string=%s", "878248638726478362877bewnh fdhejiwdheiudwuiheuhduihewudheuiwhduiewhduiehwiudheuwh");
HTTP(2, HTTP_GET, result, "", "MyHttpResponse");
What I get in the access log on the webserver is "[13/Nov/2017:19:37:24 +0000] "" 400 349 "-" "-""
With this different code but with a shorter string, it works.
pawn Code:
new result[128];
format(result, 128, "website.com/linuxthefish.php?data=%s", "8.8.8.8");
HTTP(1, HTTP_GET, result, "", "MyHttpResponse");
And I get this in the access logs.
"[13/Nov/2017:18:17:04 +0000] "GET /linuxthefish.php?data=8.8.8.8 HTTP/1.0" 200 0 "http://sa-mp.com" "SAMP/0.3""
Re: HTTP function broken? Can't send long strings! -
linuxthefish - 13.11.2017
Alternately I could extra the IP 8.8.8.8 from the string "fishtest - Max Speed: 45 MPH, Vehicle Health: 0.00, IP: 8.8.8.8, Ping: 394 ms", but sscanf isn't having any of it
Re: HTTP function broken? Can't send long strings! -
NaS - 13.11.2017
Did you try replacing the space with "%20"? Note: In format you need to use 2 percent signs to get one into the actual string. Some webservers are unable to handle it.
Ignore if you tried other long strings without spaces.
Might also be a limitation of length.
Re: HTTP function broken? Can't send long strings! -
linuxthefish - 13.11.2017
Quote:
Originally Posted by NaS
Did you try replacing the space with "%20"? Note: In format you need to use 2 percent signs to get one into the actual string. Some webservers are unable to handle it.
Ignore if you tried other long strings without spaces.
Might also be a limitation of length.
|
The problem is then I could have to break down the string in sscanf or similar, but the string I'm trying to use I think is too long for the include version. Is there a way to explode a string like in PHP?
$pieces = explode(" ", "Max Speed: 45 MPH, Vehicle Health: 0.00, IP: 8.8.8.8, Ping: 394 ms");
echo $pieces[8];
Code:
fishtest - Max Speed: 45 MPH, Vehicle Health: 0.00, IP: 8.8.8.8, Ping: 394 ms
Re: HTTP function broken? Can't send long strings! -
NaS - 13.11.2017
Hmm. Why do you send "Max Speed" etc with it? Why not eg.
You can use spaces too, if they work! If you use spaces just for sscanf, you can put "p<,>" in front of the format specifiers to set the delimiter to be a comma.
Or did I get something wrong?
Re: HTTP function broken? Can't send long strings! -
linuxthefish - 13.11.2017
Quote:
Originally Posted by NaS
Hmm. Why do you send "Max Speed" etc with it? Why not eg.
You can use spaces too, if they work! If you use spaces just for sscanf, you can put "p<,>" in front of the format specifiers to set the delimiter to be a comma.
Or did I get something wrong?
|
I'm phrasing the output of something else (or trying to), but then changed my mind and tried to send the whole string to a PHP script. I can't control what parts of the string I receive or modify it before it's sent, apart from after having received it.