So I've set up a web server with my arduino uno and I am having trouble getting the word from the headers. I guess I'm little confused on how to get it. I've tried looking up some methods but none seem to prevail. Maybe i'm not doing the methods properly I just wonder if someone could point me into the right direction.
Here is my code
#include <SPI.h>
#include <Ethernet.h>
#include <LiquidCrystal.h>
#include <Time.h>
#include "RTClib.h"
#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
#define Serial SerialUSB
#endif
RTC_Millis rtc;
LiquidCrystal lcd(9, 8, 7, 6, 5, 2);
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x98, 0xAD };
// IPAddress ip(192, 168, 1, 177);
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
rtc.begin(DateTime(F(__DATE__), F(__TIME__)));
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
lcd.begin(16, 2);
// start the Ethernet connection and the server:
Ethernet.begin(mac);
server.begin();
Serial.print("server is at ");
Serial.println(Ethernet.localIP());
}
void loop() {
DateTime now = rtc.now();
lcd.setCursor(0,0);
lcd.print(" ");
lcd.print(now.hour(), DEC);
lcd.print(':');
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
lcd.print(" ");
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.day(), DEC);
EthernetClient client = server.available();
if(client){
Serial.println("New Client");
boolean clib = true;
while(client.connected()){
if(client.available()){
char c = client.read();
Serial.print(c);
if(c == '\n' && clib){
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println("Refresh: 5");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
client.println("<head><title> Testing </title></head><body><h1>Testing http requesting using GET method</h1>");
client.println("<form action='GET'><input type='textbox' name='timezone'><button type='submit'>submit</button></form></body></html>");
}
if(c == '\n'){
clib = true;
}
else if(c != '\r'){
clib = false;
}
}
}
delay(1);
client.stop();
Serial.println("Client disconnected");
}
}
here are is the data I get back:
server is at 192.168.0.14
New Client
GET /GET?timezone=Words HTTP/1.1
Host: 192.168.0.14
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36
Referer: http://192.168.0.14/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Im trying to get what comes after the /GET?timezone=