How does HTTP work?
#1

I am making a communication system to see how many players are online. How do I communicate the variable.
Do I make the url like: "http://mysite.org/index.php?players=" (data): "Players"

Код:
HTTP(playerid, HTTP_GET, "www.mysite.net/test/index.php?players=", HeadCount, "");
^.^ Like that?
Reply
#2

I'm not sure exactly what you're asking, but for GET data that is how you format the URL, for example:

pawn Код:
www.mysite.net/test/index.php?var1=hi&var2=how&var3=are&var4=you
Then in PHP you can access them through the $_GET variable.

So for this particular example, assuming HeadCount is an integer you have made that stores the amount of players in the server, then all you need to do is this:

pawn Код:
format(string, sizeof(string),"www.mysite.net/test/index.php?players=%d",HeadCount);
HTTP(playerid, HTTP_GET, string, "", "");
I hope that helps, the Wiki should provide you with just about all of the information you need.

https://sampwiki.blast.hk/wiki/HTTP
Reply
#3

Well, I know what I said was jumbled. But, I want to pull data from my server and send it to my site. But, do I put the url with the data in it? or do I have to put it in the data area in the format?
Reply
#4

Quote:
Originally Posted by ScottCFR
Посмотреть сообщение
Well, I know what I said was jumbled. But, I want to pull data from my server and send it to my site. But, do I put the url with the data in it? or do I have to put it in the data area in the format?
Well I think my example is pretty self explanitory, that should work right off of the bat.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)