WiFi sheild - can read HTML from some, but not all sites. Why?

I have recently purchased an Arduino WiFi shield (and Uno) with the hope of connecting it to a web site hosted by the www.iinet.com domain. With the help of the great examples on this site, I am able to connect the shield to my router and read content from most of the web. For example, I can see web content from www.google.com or www.cnn.com. My problem has to do with the fact the the PHP files I really want to talk to are hosted by my ISP (www.iinet.com) and I can't seem to connect to my pages or to that site at all. I've tried using the domain name in statements such as: char server[]="www.iinet.com"; and I've tried the IP address with no luck. Whenever I run "client.connect( server, 80);" where server describes that domain, all I get back is "false" (no connection).

I was wondering if someone else could use their shield and try pointing it to "www.iinet.com" to see if you get the same results. If so, is there a reason why some sites do not result in a successful connection when using client.connect()? For example, if my ISP redirects the client, will that trigger a "false" when calling client.connect()? Any help would be appreciated. I'm looking forward to using my shield to help monitor and control my garden remotely (while I travel), but need to connect to my PHP pages first.



You're probably not sending a proper Host: header.

Post all your code, in code tags, and you'll get a better answer…


Because the client.connect() returns false, the shield never sends the HTTP head information. It sure looks to me as though the shield can’t connect to that domain over port 80, but I don’t understand why.

Here is the code I’ve been using (more or less)…

Note that if I replace “www.iinet.com” with mostly any other domain name, the code works as expected and I can see the HTML write out through the serial port. So any help connecting to “www.iinet.com” would be appreciated. The site loads just fine in any conventional web browser.

#include <WiFi.h>

char ssid[] = "David's Network";     //  your network SSID (name) 
char pass[] = "XXXXXXX";    // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status
IPAddress ip;
char server[]="www.iinet.com";
WiFiClient client; 

void setup() {
  // initialize serial:

  // attempt to connect using WPA2 encryption:
  Serial.println("Attempting to connect to WPA network...");
  status = WiFi.begin(ssid, pass);

  // if you're not connected, stop here:
  if ( status != WL_CONNECTED) { 
    Serial.println("Couldn't get a wifi connection");
  // if you are connected, print out info about the connection:
  else {
    Serial.println("Connected to network");
    ip = WiFi.localIP();
    //if (client.connect( server, 80)) {  
    Serial.println("Trying to make an HTTP request....");  
    if (client.connect( server, 80)) {
      Serial.println("connected to server.");
      client.println("GET HTTP/1.1");
      //client.println("User-Agent: Mozilla/3.0Gold");
      client.println("Host: www.iinet.com");
      //client.println("Connection: close");
      Serial.println("No connection....");

void loop() {
  // if there are incoming bytes available 
  // from the server, read them and print them:
  while (client.available()) {
    char c = client.read();

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println("disconnecting from server.");

    // do nothing forevermore:

Properly forming the GET request might help:

      client.println("GET / HTTP/1.1");


That might explain why some web sites complained that the request seemed funny, but when this code is pointed at www.iinet.com that line of code is never executed because the "if" condition just above it evaluates to false.

Your advice will come in very handy once I get this shield connect to this domain. :-)


So you're seeing "Connected to network…" followed by "No connection…"?


Here is the exact serial output that results:

Attempting to connect to WPA network...
Connected to network
Trying to make an HTTP request....
No connection....

That domain looks normal from here via browser and curl.

Are you familiar with Wireshark? It might be time to do a little packet sniffing to watch the TCP connection setup that's not working.


No, I'm not familiar with Wireshark. I'm on a Mac, but even if I could run it, based on their example videos, I don't think I have a deep enough understanding of the network protocols to debug this issue. I was hoping somebody on this forum might be able to point their shield to "www.iinet.com" just to see if they get the same results. If so, I might be able to work with my ISP, or that might be enough incentive to author my PHP with some other hosting service.

But many thanks billroy for all your helpful suggestions and advice.


Works ok with an ethernet shield.