If someone would be kind enough can you post an example of Lua making call to to post data to a php script.
For example say I have php script on my web server as:
[php]Welcome <?php echo $_POST["fname"]; ?>!
[/php]
How can I use Lua to send a string with the value Joan?
As a plus how would I update my php script to also return the age of Joan assuming she is 85?
I’m having trouble figuring this out. I tried to piece it together with general php code, but can’t figure it out with Lua
Ok, now that I was able to have 1 hour without a biting and pinching 1 year old on my lap I think I figured out a way to do this:).
My goal is to interface with a centralized database such as PostgreSQL to work on a multi-player drum role… tic tac toe game my daughter and I are working on. So if you have a Lua script with the contents below and a php script with the contents below I think it should work. Thanks to ehsmeng for this post to get me started [html]http://developer.anscamobile.com/code/post-json-data-and-receive-json-data-example[/html]
–START LUA
[lua]http = require(“socket.http”)
ltn12 = require(“ltn12”)
url = require(“socket.url”)
local post = “InputName=” … “Robot7001”
post = post … “&InputAge=” … “8”
local response = {}
<?php
if ( $\_POST[InputAge] \<= 30 )
echo ("You young " . $\_POST[InputName] . "." );
else echo ("You getting old" . $\_POST[InputName] . "!" );
?\>
[/php]
Hopefully this will be of value to someone wanting to talk to a php script or any web hosted script for that matter. At some point sending json or some other speced data will probably be a good idea and should be pretty easy with Lua and PHP.
I know for me this is one step closer to taking over the world with multi-player tic tac toe! [import]uid: 10640 topic\_id: 4452 reply\_id: 13955[/import]