Loading...
Pages: [1]   Go Down
Author Topic: Retrieving "GET" HTML Form Data  (Read 475 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 122
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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
Logged

0
Online Online
Tesla Member
***
Karma: 50
Posts: 6536
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can print what is received or sent to the serial monitor.
Logged

Why I like my 2005 rio yellow Honda S2000 with the top down, and more!
GOOGLE ADVANCED FORUM SEARCH BELOW!  
Go to:  http://www.google.com/advanced_search?hl=en
put in key search words,
use site or domain:  http://arduino.cc/forum
or in a google search box put key words site:http://arduino.cc/forum

0
Offline Offline
Full Member
***
Karma: 0
Posts: 122
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Online Online
Tesla Member
***
Karma: 50
Posts: 6536
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Why I like my 2005 rio yellow Honda S2000 with the top down, and more!
GOOGLE ADVANCED FORUM SEARCH BELOW!  
Go to:  http://www.google.com/advanced_search?hl=en
put in key search words,
use site or domain:  http://arduino.cc/forum
or in a google search box put key words site:http://arduino.cc/forum

0
Offline Offline
Full Member
***
Karma: 0
Posts: 122
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it possible to get some sample code?
This is what I have right now, and I don't think it's working:
Code:
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());
Logged

Pages: [1]   Go Up
Print
 
Jump to: