I would like to have my Arduino update my no-ip host. I have created this code based on the API published by no-ip:
http://www.no-ip.com/integrate/request/Below is my code and the output on the serial monitor. According to the no-ip API documentation, the server should provide a response, but I have been unable to get one. I believe my mistake must be somewhere in the http get request or in reading the response. Any help is appreciated. I would just like to be able to get a response, even if it is an error response.
Code:
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x04, 0x16 };
char noipServer[] = "
https://dynupdate.no-ip.com";
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 initilize:
delay(2000);
if(client.connect(noipServer, 80)){
Serial.println("Connected to noip");
client.println("GET /nic/update?hostname=johndoe.no-ip.org HTTP/1.0");
client.println("Host: dynupdate.no-ip.com");
client.println("Authorization: john.doe@gmail.com:mypassword");
client.println("User-Agent: Johns Arduino Client/0.0
john.doe@gmail.com");
client.println();
//Wait for response
delay(5000);
Serial.print("Characters available: ");
Serial.println(client.available());
while(client.available() > 0)
{
char read_char = client.read();
Serial.print(read_char);
}
}
}
void loop() {
}
Output:
Connected to noip
Characters available: 0