Reading data from Webserver


dear all,
here pasting code. new in programming web server. wanted know how read data web server. in below code trying read data web server using date , time modified.
i wanted know  below thing:
1) if edit option selected how disable edit option, user cant change date , time
2) how read data client.
3)is there application software can create own tags , link arduino web server
http://www.w3schools.com/html/html_forms.asp
code: [select]

#include <spi.h>
#include <ethernet.h>
static int local_day;
static int local_month;
static int local_year;
static int local_s;
static int local_h;
static int local_m;
byte mac[] = {
 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed };
byte ip[] = {
 192, 168,1, 120 };  
ethernetserver server(80);
void setup()
{
 ethernet.begin(mac, ip);
 server.begin();
}
void loop()
{
 ethernet_control();
}
void ethernet_control()
{
 ethernetclient client = server.available();
 // detect if current first line
 boolean current_line_is_first = true;

 if (client) {
   // http request ends blank line
   boolean current_line_is_blank = true;
   while (client.connected()) {
     if (client.available()) {
       char c = client.read();

       // if we've gotten end of line (received newline
       // character) , line blank, http request has ended,
       // can send reply
       if (c == '\n' && current_line_is_blank) {
       
         // send standard http response header
         
       
         client.println(f("http/1.1 200 ok"));
         client.println(f("content-type: text/html"));
         client.println();
         client.println("<input type=\"checkbox\" name=\"edit\" value=\"2\" \
       onclick=\"submit();\" checked>edit");
         client.print(" <font> <color=blue> dd: <input type=text name=01 value=");
         client.println(local_day);
         client.print(" <font> <color=blue> month: <input type=text name=01 value=");
         client.println(local_month);
         client.print(" <font> <color=blue> year: <input type=text name=01 value=");
         client.println(local_year);
         client.print(" <font> <color=blue> hour: <input type=text name=01 value=");
         client.println(local_h);
         client.print(" <font> <color=blue> min: <input type=text name=01 value=");
         client.println(local_m);
         client.print(" <font> <color=blue> sec: <input type=text name=01 value=");
         client.println(local_s);
         client.println("");
          client.println(f("</form><br />"));
          client.println(f("<button name=d value=1 type=submit style=height:30px;width:50px>ok</button>"));
         client.println("<p>note: page automatically refresh every 5 seconds.</p></center>");
         
         
         client.println(f("<center><p><h5>web application  v1.0</h5></p><center><hr><br />"));
         client.print(f("<p><h5>date: = <font color=indigo>"));
         client.print(local_day);
         client.print("/");
         client.print(local_month);
         client.print("/");
         client.print(local_year);
         client.println("</font></h5></p>");
         client.print(f("<p><h5>time: = <font color=indigo>"));
         client.print(local_h);
         client.print(":");
         client.print(local_m);
         client.print(":");
         client.print(local_s);
         client.println("</font></h5></p>");
       
         

         break;
       }

       if (c == '\n') {
         // we're starting new line

         current_line_is_blank = true;
       }
       else if (c != '\r') {
         // we've gotten character on current line
         current_line_is_blank = false;
       }
     }
   
   }
 delay(1);
 client.stop();  

}
}



Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Reading data from Webserver


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support