Jump to content




http.post example

api

  • You cannot reply to this topic
2 replies to this topic

#1 MineRobber___T

  • Members
  • 50 posts
  • LocationStop being nosy

Posted 13 December 2015 - 06:26 AM

How do you use http.post() to send data to a server? Basically, I have a PHP script that will interact with a database depending on the data it's given; how do I give it data?

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 13 December 2015 - 06:49 AM

http.post("yoursite.com", "postdata=whatever&morepostdata=blahblah")

... is pretty much the same as sticking this into your web browser's address bar:

yoursite.com?postdata=whatever&morepostdata=blahblah

Keep textutils.urlEncode() in mind, and see the pastebin script's source a more thorough example.

#3 MineRobber___T

  • Members
  • 50 posts
  • LocationStop being nosy

Posted 13 December 2015 - 07:01 AM

So, "$_POST['oper']" being set to a value would be:
http.post("minerobbercc.x10host.com/cc-scripts/sm-suite.php", "oper=blah")

Right?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users