HTTP GET & POST Test

HTTP GET & POST Examples

This simple webpage contain very simple PHP script to demonstrate the HTTP GET & POST method through GPRS. This is to be used together with our WISMO228 Arduino compatible library. We just picked up PHP few days back, so please bear with us if the stuff we have here looks like a beginner PHP scripts (and probably not secured!). We know not everyone have an access to a server, so we hope this help you get going!

Despite it's obvious name GET, which suggest that when you use this HTTP method, you'll receive or retrieve something from a server. Yes, the GET method allows you to do that. But, with the limited processing capability (memory & speed) on an Arduino board, the large amount of data you received when using the GET method to retrieve a webpage, will be nearly impossible to process. However, the GET method can also be used to send data to a server providing that the server allows and have scripts to fetch this data of yours. The drawback of this method is the limitation of the length of data (2048 characters, that's the amount of RAM you have on an ATMega328!) that can be sent over to the server. Another drawback would be the visibility of data that you want to send to the server. For example, when you want to send a data with a data field name called "temperature" & value of "25", you'll need to submit something like this:

http://www.domain.com/someScript.php?temperature=25

But, if what you are sending is not crucial or private (like password or username), the GET method is probably the simplest form to send data to a server. We made a simple PHP script that will take in 2 parameters called "name" and "countryCode" submitted by the user and write them into a text file together with the time and date. The "name" as it implies is your name and "countryCode" is a 2 letters ISO3166 country code. If your country code is valid, your GET request will be inserted in the text file. You'll be able to see the submitted data at the link listed below for data submitted using the GET method. This allows you to test the HTTP GET method over the GPRS. Using our WISMO228 Arduino compatible library, you'll need to use the following path for the HTTP GET request:

/getData.php?name=Dean&countryCode=US

Obviously, you need to change the name Dean (okay we have been watching demons & angels lately) to your name and the 2 letters country code to your country code. You can try this directly on the browser with the complete address of this server and check whether your data is correctly submitted into the file. Once you get this working, move on to the Arduino board.

The POST method in contrast has parameters that is not visible. Instead of seeing the parameters like the GET method above, you'll see only the path where the script is located:

http://www.domain.com/someScript.php

In a way, it is considered more secure. The length of data that can be sent through this method is larger (usually being imposed by the server itself).

Jump to the relevant pages below to see the current data posted using the GET & POST method. If the file size containing the data gets too large over time, we'll remove them and place a new one. This is a very small server with limited bandwidth.We hope it helps you to understand the capability of HTTP method GET and POST over GPRS network. You can always expand the PHP scripts to write into a database and present them with some awesome graphs and charts. We haven't implement the POST method script yet.

If you have any suggestions or comments, drop by our website, we'll be glad to hear from you!

HTTP GET
HTTP POST

© 2015 Rocket Scream Electronics