Things to do with the HTTP function
#1

Hello, I have be wanting to use the HTTP function which was released with 0.3b but I have no idea what I can do with it, so could someone elaborate please?
Reply
#2

Well one example is my samp-bans.com website. You can use HTTP POST requests to deal with the API on that website and use it to manage your bans.

You could technically use it to do anything, just setup a website, write some PHP and then you can send a request to it from your SA-MP server with some POST or GET data. Some people have used it so that they can send mail from their server using the mail function in PHP and the HTTP function in SA-MP.
Reply
#3

removed personal details, luis you fag! xD
Reply
#4

That is GET data, so all you have to do is this:

pawn Code:
HTTP(playerid, HTTP_GET, "http://linuxthefish.net/mail.php?to=&subject=Hello&message=This", "", "MailResponse");

public MailResponse(index, response_code, data[])
{
    SendClientMessage(index, 0xFFFFFF, "You sent the email");
    printf("Response code: %d", response_code); // The response code is what the page responded with...200, 404, 500 etc.
    printf("Page returned: %s", data); // data contains the information that was on the page
    return 1;
}
Hope that simple example helps!

Note: That link you pasted wouldn't be passing all of the GET data you are intending, the first identifier is the ? symbol which is followed by the first GET variable and its value, to add additional ones, you need to use the & identifier.
Reply
#5

i made a function that runs every ten minutes and if the website says 0 it will shutdown the server, usefull for sending out demo amx files and managing them so if your scripting for money to make sure you get payed
Reply
#6

Quote:
Originally Posted by dowster
View Post
i made a function that runs every ten minutes and if the website says 0 it will shutdown the server, usefull for sending out demo amx files and managing them so if your scripting for money to make sure you get payed
That's not really a good example, that could easily be bypassed by pretty much anyone!
Reply
#7

removed personal details
Reply
#8

This is probably a lot to ask but how would I use the HTTP_POST function to post in a SMF forum?
Reply
#9

Quote:
Originally Posted by JaTochNietDan
View Post
That's not really a good example, that could easily be bypassed by pretty much anyone!
probably but i had it so that if it wasnt able to connect to the site it would lock out, also i was only giving the amx until payment so they couldnt edit it. it seemed pretty secure but i guess with a quick netstat, and a modification to your hosts table you would be home free.
Reply
#10

Quote:
Originally Posted by -Luis
View Post
This is probably a lot to ask but how would I use the HTTP_POST function to post in a SMF forum?
That would be quite difficult really, it would be a lot easier to just create your own quick PHP script to actually cater to your needs and write the values into the MySQL database SMF tables with the required information. Even that would be a little difficult though, you'll need to basically learn how SMF works on the inside and learn about their table setup etc in order to write a PHP script to write the sufficient information in the MySQL database.

Someone has made an include though that apparently works with SMF in various ways, that may contain examples on how you can do this, I suggest you go look for it
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)