Problem with Shared IP and client.connect

I am trying to connect my Arduino ethernet to my isp where my homepage is. I have made a php script to add values to the data base. The php script works when I use it from a html POST page. But when I try to use Arduino to update data base I have a problem. I have tried numerous things and I think I have found what the problem is but I do not know why or how to fix it.
The problem seems to be that my homepage is on a shared ip. Lets say my host is and it results in ip With regular web browser I can access my script with but not with this seems to be the down side of shared ip. I found a couple of posts to get around this using the full url in the client.print("GET… and also send HTTP/1.1 and client.println("Host:… This might help but I get stuck earlier at if (client.connect(server, 80)>0).

This works
//byte server = { 74, 125, 143, 147 }; // Google
if (client.connect(server, 80)>0)

This does not
//byte server = { 212, 97, 132, 103 }; //
if (client.connect(server, 80)>0)

it seems to time out.

This works //byte server[] = { 74, 125, 143, 147 }; // Google if (client.connect(server, 80)>0)

This does not //byte server[] = { 212, 97, 132, 103 }; // if (client.connect(server, 80)>0)

It doesn't look to me like either one of them will work, since the declaration of server is commented out in both cases.

With HTTP, you establish a TCP connection to a server and then send an HTTP request to the server. The request includes the host name of the site you want to access in the form of a Host: field within the request header, which is usually the domain name part of the URL you are accessing. Some servers aren’t fussy about what you set the Host: header to, but a single server may accept requests for multiple hosts (sites) and in that case you would need to specify the correct site using the Host: header field.

Client test code that connects to my web server using DNS.

//zoomkat 2-13-12
//DNS and DHCP-based web client test code
//for use with IDE 1.0
//open serial monitor and send an e to test
//and to see test result
//for use with W5100 based ethernet shields
//browser equivelant URL: 
//note that the below bug fix may be required

#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
char serverName[] = ""; // zoomkat's test web page server
EthernetClient client;


void setup(){
  Serial.println("DNS and DHCP-based web client test 2/13/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
  // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
  // print your local IP address:
  Serial.print("Arduino IP address: ");
  for (byte thisByte = 0; thisByte < 4; thisByte++) {
    // print the value of each byte of the IP address:
    Serial.print(Ethernet.localIP()[thisByte], DEC);

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
    byte inChar; // sets inChar as a byte
    inChar =; //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
      sendGET(); // call sendGET function below when byte is an e


void sendGET() //client function to send/receive GET request data.
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request
  else {
    Serial.println("connection failed"); //error message if no client connect

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c =; //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 

  client.stop(); //stop client


Thank you zoomkat for your test script. I tried it with some urls and here are the results.

With looks like its a shared ip and it sent me to this page it does that if you do a dns on and you get and then type that in your browser and you will not go to To fix this I added a line in your script just after

client.println("GET /index.html HTTP/1.0"); //download text client.println("Host:");

now it sent me to the right page.

But when I try with (wich is a working page) I get connection failed after it times out.

I wonder why is does not connect.