This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MineRobber___T's profile picture

http.post example

Started by MineRobber___T, 13 December 2015 - 05:26 AM
MineRobber___T #1
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?
Bomb Bloke #2
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.
MineRobber___T #3
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?