lua with php

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
darklitch
Posts: 11
Joined: Mon Oct 03, 2005 9:55 am
Contact:

lua with php

Post by darklitch »

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")
modsyn
Posts: 28
Joined: Tue Sep 27, 2005 6:02 am

Post by modsyn »

well, first you'd need to get the data you're sending somehow in your
lua application.

Code: Select all

varname1 = "data1"
varname2 = "data2"
then, you'd need to format that (or url-encode it) to send with your socket

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")
of course, you probably are doing something more complex than that.
but i think that should answer most of your question.
Post Reply