Go Down

Topic: Retrieving "GET" HTML Form Data (Read 1 time) previous topic - next topic

phinsil6

Hi everyone,
I am trying to serve a simple webpage with the ethernet shield and arduino dum.   If I have a command such as this:
Code: [Select]
client.println("<form name=\"input\" action=\"subnet\" method=\"get\"> Subnet: <input type=\"text\" name=\"newSubnet\"> <input type=\"submit\" value=\"Submit\"> </form>");
What command can I do afterwards to read the form data that was submitted?

Something like a client.read("...");

Thanks for any help

zoomkat

You can print what is received or sent to the serial monitor.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

phinsil6

But how do I only get the data from the form submission and not all the other stuff?  On this web page I have multiple forms, so how can I specify the form?

zoomkat

Well, you are going to get all the "stuff" one character at a time. GET request are fairly short and probably can be captured directly into a string for evaluation. You can use the string function to parse out the desired data from the captured string. I don't think I've delt with the POST request, but if there is a lot of info, you may need to evaluate the characters as they are processed to start a string capture of the material desired when it is encountered.
Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

phinsil6

Is it possible to get some sample code?
This is what I have right now, and I don't think it's working:
Code: [Select]
web_browser.println("<form name=\"input\" action=\"password\" method=\"get\"> Password: <input type=\"password\" name=\"PASSword\"> <input type=\"submit\" value=\"Submit\"> </form>");
         String input_password = String(web_browser.read());

Go Up