SA-MP Forums Archive
explain http(); someone? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: explain http(); someone? (/showthread.php?tid=219033)



explain http(); someone? - DarrenReeder - 31.01.2011

What is the http function used for? ive read the samp wiki and it doesnt make much sense to me.


Re: explain http(); someone? - Steven Paul - 31.01.2011

it is a thing which connects you with a website. For Example

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/stevenpaul",cmdtext,true))
    {
        HTTP(playerid, HTTP_GET, "www.crimeliferoleplay.com/stevenpaul.txt", "", "MyHttpResponse");
        return 1;
    }
    return 0;
}
it reads the txt on the page


Re: explain http(); someone? - DarrenReeder - 31.01.2011

What does it do once it reads the txt on the page? how does this benefit me/


Re: explain http(); someone? - Steven Paul - 31.01.2011

all explanation HERE


Re: explain http(); someone? - Hal - 31.01.2011

Quote:
Originally Posted by Steven Paul
Посмотреть сообщение
all explanation HERE
he obv. doesnt understand what it means by reading the page. He wants to know how people use it, and how it benefits them. If you stop spamming and read the OP you will see that he already read the wiki.

OP: I've seen it been used for a country finder, dont know how though


Re: explain http(); someone? - DarrenReeder - 31.01.2011

what data is getting replied?? if you rread my original post you will see that ive already read that page


Re: explain http(); someone? - Steven Paul - 31.01.2011

ok let me teach you ok, If i am good at that

pawn Код:
public OnGameModeInit()
{
   
    HTTP(0,HTTP_GET,"i-fair.eu/test.txt","","GetHostnameFromServer"); // This send's the signal through your web
    return 1; // This returns it
}
forward GetHostnameFromServer(response_code,data[]); // This will forward the call back

public GetHostnameFromServer(response_code,data[]) // This is the callback for it
{
    if(response_code == 200) // If the response code is 200
    {
         printf("Content : %s",data); // This will print if it all works
    }  
    else printf("Failure ! Reason = %d",response_code); // else Failure
    {
       return 1; // This will return
    }
}

Sorry. I am not good at HTTP function