ESP8266 Web Get doesn't work

I have the sparkfun ESP8266 wifi shield with an external antenna. It connects and pings good (I think). It gets an IP for sure but the output that I’m getting is:

The website I’m calling is definitely working and I have it logging any calls to it and it’s never getting called.

Starting Connected to IP:

busy p…

busy p…


The code:

#include <SoftwareSerial.h>
#include <SparkFunESP8266WiFi.h>

const char mySSID = “mywifi”;
const char myPSK = “mypassword”;

void setup()
Serial.print("Starting ");

while (esp8266.begin() != true)
Serial.print(“Error connecting to ESP8266.”);

ESP8266Client client;

if (esp8266.status() <= 0)
while (esp8266.connect(mySSID, myPSK) < 0)

Serial.print("Connected to IP: ");
Serial.print("Getting ");

esp8266.print(“GET / HTTP/1.1\nHost:\nConnection: close\n\n”);


while (esp8266.available())

if (client.connected())

Serial.println("Done ");

void loop()


Any thoughts?

esp8266.print("GET / HTTP/1.1[color=red]\n[/color]Host:[color=red]\n[/color]Connection: close[color=red]\n\n[/color]");

Don't use \n in your http request but use \r\n, because it's defined as the line break in the HTTP protocol specification (RFC2616) - some server will work with just '\n' but that's a bad idea to take the chance.

The way you wait for the answer ( 3 second pause and then read all that has arrived) is pretty poor. Implement a proper read of an HTTP answer or you will miss data due to buffer overflow or not waiting long enough and emptying all the incoming buffer

Thank you for the reply. I tried that (finding it on various samples) and it didn’t change the outcome (identical error response).

The data being returned from the web page is simply “ok” so that I know it’s doing something. I don’t really know how to do a “proper” http answer. All the demo’s seem to treat the code sequential. I added the delay just as an “in case” but it has the same result with that or without that.

Before you issue the get, you must make a connection to the web server on port 80 (usually). Your URL must be of the type http://. Https:// is not supported.

Edit: Since you are using the sparkfun library, look at this example:

Your code is missing the equivalent of:

retVal = client.connect("", 80); // Connect to sparkfun (HTTP port)
if (retVal > 0)
    Serial.println("Successfully connected!");

That did it - thank you so much!

Here are the changes for others who may be suffering like me haha:

if ( !client.connect(“”, 80) ) {
Serial.print(“Error connecting to website.”);

client.print(“GET / HTTP/1.1\r\nHost:\r\nConnection: close\r\n\r\n”);