@richtornado, I would hope that you are already using HTTP GET because many URL’s you might type into a web browser use this already. If you use YouTube you use URLs like:
https://www.youtube.com/watch?v=8f6e3e7-gvA
So you’re connecting to the website www.youtube.com using the https protocol. This will run a script called “watch” and it passes a key-value pair after the question mark. The key is “v” and the value is “8f6e3e7-gvA”
If there are additional key-value pairs, they would be separate by an ampersand (&) like:
https://www.youtube.com/watch?v=8f6e3e7-gvA&rel=0&showinfo=0
In this case, there are two extra key-value pairs: rel = 0 and showinfo = 0
Depending on how the script is coded, the order of the parameters shouldn’t matter because internally your going to look up the keys in a table by key to get the value. If this was done with PHP then you could do:
$showInfo = $\_GET["showinfo"]; $rel = $\_GET["rel"] $video = $\_GET["v"]
Now you have those parameters. Now YouTube can use GET for this because there isn’t any data in the URL that needs to be secured. But if you’re passing user credentials like usernames and passwords, you don’t want to use GET (this is putting the key-value pairs on the end of the URL) because they can’t be secured.
If your server is running https instead of http you get free encryption of your data if you use POST instead of GET. The key-value pairs are not part of the URL in this case, but sent as data to that URL.
Corona lets you pass a table of data to network.request() that ends up being the data that will be sent with POST. It’s still a bunch of key-value pairs. Consider this code:
local params = {} params.body = "v=8f6e3e7-gvA&rel=0&showinfo=0 network.request( "https://www.youtube.com/watch", "POST", networkListener, params )
First, let me say, I doubt this would work because the watch script probably won’t take a POST request, I’m just using it as an example.
Since we are on HTTPS, the POST data will be encrypted and decrypted automatically for you. In your PHP script instead of using $_GET[] to access the variables are in a table named $_POST[] and you can do:
$video = $\_POST["v"]; $rel = $\_POST["rel"]; $showinfo = $\_POST["showinfo"];
Now your script can work with those variables as needed.