[Pedido] a_http
#5

pawn Код:
CMD:ler(playerid)
{
    HTTP(playerid, HTTP_GET, "site.com/arquivo.txt", "", "MyHttpResponse");
    return 1;
}

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), "Dados recebidos: %s", data);
        printf("%s",buffer);
    }
    else
    {
        //No!
        format(buffer, sizeof(buffer), "The request failed! The response code was: %d", response_code);
        printf("%s",buffer);
    }
}
Isso ?
Reply


Messages In This Thread
a_http - by tonisantolia - 05.12.2012, 01:39
Re: a_http - by Jason` - 05.12.2012, 01:54
Re: a_http - by Joao Pedro - 05.12.2012, 02:49
Re: a_http - by Schocc - 05.12.2012, 03:17
Re: a_http - by BreakDriFT - 05.12.2012, 03:23

Forum Jump:


Users browsing this thread: 5 Guest(s)