I have a working .php file on a remote server. If I run the following:
curl -F "USER=user" -F "PASS=pass" -F "TIME=12345" -F "EMAIL=email@email.com" http://myurl.com/create.php
it will return:
{"PASS":"pass","USER":"user"}
However, I'm trying to use the same code with a new interface programmed in lua, and while it DOES contact the server, it also returns "Invalid request". I've setup the .php to return "Invalid request" if the proper POST values aren't set.
I edited the .php to return whatever the input received was, and it's replying:
{"PASS":null,"USER":null}
My .php code is generally as follows:
if (isset($_POST["USER"]) && isset($_POST["PASS"]) && isset($_POST["TIME"]) && isset($_POST["EMAIL"])){
[...]do stuff[...]
}else{
sendResponse('Invalid request');
}
And the lua code:
require "socket.http"
function curlCreate()
response= socket.http.request("http://myurl.com/create.php","USER=user", "PASS=pass", "TIME=12345", "EMAIL=email@email.com")
print(response)
end
I'm believe that it's perhaps the -F flag provisions mucking up the lua transmission, but documentation on lua curl-ing is a bit sparse and old.
Thanks in advance for any suggestions!
ANSWER DETAILS: The first recommended method of...
response= socket.http.request("http://someurl.com", "USER=user&PASS=pass&TIME=12345&EMAIL=email@email.com")
...did indeed work!