HTTP not responding(code: 1) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: HTTP not responding(code: 1) (
/showthread.php?tid=529828)
HTTP not responding(code: 1) -
Gintaras123 - 04.08.2014
code(from sa-mp wiki , just for testing):
Code:
forward MyHttpResponse(index, response_code, data[]);
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/hello",cmdtext,true))
{
// URL: ftp://gintars@safg.wu.lt/hello.txt
HTTP(playerid, HTTP_GET, "gintars@safg.wu.lt/hello.txt", "", "MyHttpResponse");
return 1;
}
return 0;
}
public MyHttpResponse(index, response_code, data[])
{
// In this callback "index" would normally be called "playerid" ( if you didn't get it already :) )
new
buffer[ 128 ];
if(response_code == 200) //Did the request succeed?
{
//Yes!
format(buffer, sizeof(buffer), "The URL replied: %s", data);
SendClientMessage(index, 0xFFFFFFFF, buffer);
}
else
{
//No!
format(buffer, sizeof(buffer), "The request failed! The response code was: %d", response_code);
SendClientMessage(index, 0xFFFFFFFF, buffer);
}
}
current php version :5.5
Re: HTTP not responding(code: 1) -
Gintaras123 - 05.08.2014
bump
Re: HTTP not responding(code: 1) -
Gintaras123 - 06.08.2014
bump(the last one)
Re: HTTP not responding(code: 1) -
paulommu - 06.08.2014
Return code
1 means
HTTP_ERROR_BAD_HOST, probably because the URL you've specified isn't valid (it looks like an email account, actually). As far as I know, URLs can't have '
@' on the domain name (****** Chrome even corrected it for me, I've tried to access that website but it removed everything from
@ to back), so you should check it.
Also, you can check all the return codes meaning on the wiki -
https://sampwiki.blast.hk/wiki/HTTP
Re: HTTP not responding(code: 1) -
Gintaras123 - 06.08.2014
Im getting error 6 now, which seems to be website issue, but code working with a free website.
Big thanks to you, it was really important for me.