I need to send post data to a php file. Once I connect to my server, how do I send the request? Without the data it is something like:
test = socket:send("GET /test.php HTTP/1.0\r\n")
test = socket:send("host: www.somewebsite.com\r\n\r\n")
lua with php
Moderators: Shine, Insert_witty_name
well, first you'd need to get the data you're sending somehow in your
lua application.
then, you'd need to format that (or url-encode it) to send with your socket
of course, you probably are doing something more complex than that.
but i think that should answer most of your question.
lua application.
Code: Select all
varname1 = "data1"
varname2 = "data2"
Code: Select all
test = socket:send("POST /test.php?var1="..varname1.."&var2="..varname2.." HTTP/1.0\r\n")
test = socket:send("host: www.somewebsite.com\r\n\r\n")
but i think that should answer most of your question.