I have a solution posted under a better description. Sending HTTP: get response to a server, code for dnsExit.com IP dynamic DNS update service
I would like to make a security camera available over the internet. My ISP uses DHCP. I have signed up with dnsexit.com, a company that offers a nice variety of services and has tested a subset of my code to confirm their server is functioning correctly (kudos to their customer service). In 2days of staring, crying, and 3AM thoughts I think I have exhausted all combinations of HTML structure (trying GET POST and HTML headers) and hope a member can spot a simple false assumption that I am making. This is using an Arduino UNO with the Arduino Ethernet shield W5100 chip, SD chip not installed (that also seems to kill everything). If you create a web page using the core HTML request contained below in Firefox it works perfectly.
The code (thank you to many postings here):
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0xxx, 0xxx };
//char dnsexitServer[] = ("http://update.dnsexit.com"); this didn't get very far either - Tom
IPAddress server (67,214,161,141); //(67,214,175,75);
EthernetClient client;
void setup() {
Serial.begin(9600);
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
// no point in carrying on, so do nothing forevermore:
while(true);
}
//Give time to initialize:
delay(2000);
if(client.connect(server, 80)){
Serial.println("Connected to dnsexit.com");
client.println("GET / HTTP/1.1\r\n");
client.println("Host: update.dnsexit.com\r\n");
//Also tried using their IP directly - client.println("<form action="67.214.161.141/RemoteUpdate.sv?">");
client.println("<form action="update.dnsexit.com/RemoteUpdate.sv?">");
client.println("<input type=hidden name="login" value="Tomxxxx">");
client.println("<input type=hidden name="password" value="xxxxxxx">");
client.println("<input type=hidden name="host" value="tomandxxxxx.com">");
client.println("<input type=hidden name="myip" value="xx.103.178.xxx"");
client.println("");
//Wait for response
delay(3000);
Serial.println(client.available());
}
}
void loop()
{
// if there are incoming bytes available
// from the server, read them and print them:
if (client.available()) {
//Serial.println("in client available loop");
char c = client.read();
Serial.print(c);
}
// if the server's disconnected, stop the client:
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
// do nothing forevermore:
for(;
;
}
}
Message returned from their server:
Connected to dnsexit.com
490
HTTP/1.1 400 Bad Request
Date: Thu, 06 Sep 2012 21:46:26 GMT
Server: Apache/2.2.3 (CentOS)
Content-Length: 309
Connection: close
Content-Type: text/html; charset=iso-8859-1
Bad Request
Your browser sent a request that this server could not understand.
Apache/2.2.3 (CentOS) Server at update.dnsexit.com Port 80
disconnecting.
Apache/2.2.3 (CentOS) Server at update.dnsexit.com Port 80
There is also a simple alternative but it also fails. Only the core HTML is changed. Entering the action line in a Firefox browser address bar works great. Unfortunately I do not know how to enter it into the Arduino client "address bar". This returns the same "Your browser sent a request that this server could not understand" error message.
if(client.connect(server, 80)){
Serial.println("Connected to dnsexit.com");
client.println("GET / HTTP/1.1\r\n");
client.println("Host: update.dnsexit.com\r\n");
//Also tried using their IP directly - client.println("<form action="67.214.161.141/RemoteUpdate.sv?">");
client.println("<form action="http://update.dnsexit.com/RemoteUpdate.sv?login=Tomxxx_&password=XXXXX_&host=tomandXXX.com&myip=XX.103.178.XXX\">");
client.println("");