SA-MP Forums Archive
HTTP Problem - 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 Problem (/showthread.php?tid=660737)



HTTP Problem - akib - 12.11.2018

PHP код:
forward UpdateMap(playeridresponse_codedata[]);
public 
UpdateMap(playeridresponse_codedata[])
{
    new
        
string1028 ];
    if(
response_code == 200)
    {
        
format(stringsizeof(string), "%s"data);
        
printf("%s"string);
    }
    else
    {
        
format(stringsizeof(string), "The request failed! The response code was: %d"response_code);
        
SendClientMessage(playerid0xFFFFFFFFstring);
    }
}
public 
OnPlayerCommandText(playeridcmdtext[]){
    if(!
strcmp(cmdtext"/load")){
        
HTTP(playeridHTTP_GET"http://akibkhan.byethost7.com/maps.txt""""UpdateMap");
        
SendClientMessage(playerid, -1"CMD Sent!");
        return 
1;
    }
    return 
1;

It returns Bad Host error, but host is correct
PHP код:
http://akibkhan.byethost7.com/maps.txt 



Re: HTTP Problem - BigETI - 12.11.2018

how many times do you want to format your string?

pawn Код:
format(string, sizeof(string), "%s", data);
printf("%s", string);
Loading this URL causes a redirect, which is not response code "200".


Re: HTTP Problem - akib - 13.11.2018

Quote:
Originally Posted by BigETI
Посмотреть сообщение
how many times do you want to format your string?

pawn Код:
format(string, sizeof(string), "%s", data);
printf("%s", string);
Loading this URL causes a redirect, which is not response code "200".
Thanks for your reply, i want to show all data at once.

I fixed it, just don't use http(s)://www.