SA-MP Forums Archive
HTTP data to global? - 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 data to global? (/showthread.php?tid=313173)



HTTP data to global? - whitedragon - 24.01.2012

So i try get HTTP respond data to global variable... But i get (null)

pawn Код:
// My Code
// Top Of script
new info[56];
public OnGameModeInit() {
        HTTP(0, HTTP_GET, "webpage.address", "", "MyHttpResponse"); // webpage.address is not right address...
        print(info);
        return 1;
    }
forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
    new
        buffer[ 128 ];
    if(response_code == 200) //Did the request succeed?
    {
        format(buffer, sizeof(buffer), "The URL replied: %s", data);
        format(info, sizeof(info), "%s", data);
        print(buffer);
    }
    else
    {
        print("Error getting feedback from server.");
    }
}
Any clue why it won't show data in info?