Using SparkFun ESP8266 to post data to a node.js website

I have a node.js website up in azure http://.azurewebsites.net/adddata?first=1234&second=4232&third=393932 - When called like this through a browser it successfully writes some data to azure table storage.

My issue is that I cannot get the Arduino to call this site properly. I have been looking through tutorials for days now and don’t quite understand what I am doing wrong.

this is the code I have right now

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

char server[] = "<site>.azurewebsites.net";    // name address for Google (using DNS)
WiFiClient client;

void setup() 
{
  Serial.begin(9600);

 initializeESP8266();

  // connectESP8266() connects to the defined WiFi network.
  connectESP8266();

  // displayConnectInfo prints the Shield's local IP
  // and the network it's connected to.
  displayConnectInfo();

  serialTrigger(F("Press any key to post data."));

   Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("connected to server");
    // Make a HTTP request:
    client.println("GET /adddata?first=324324");
    client.println("Host: http://<site>.azurewebsites.net");
    client.println("Connection: close");
    client.println();
  }

}

the client.connect bit never returns true.

I have removed some of the code that connects the Arduino to Wifi, which I can do successfully.

Must be something simple that I am doing wrong, but I am not sure what it is.

char server[] = "<site>.azurewebsites.net";    // name address for Google (using DNS)

That comment is complete crap.

    client.println("Host: http://<site>.azurewebsites.net");

The host name does NOT include the http:// crap you have there.

  serialTrigger(F("Press any key to post data."));

You are NOT POSTing data…

I have removed the crap comments from the original tutorial and the crap http

Still never get a successful connection through client.connect()

#include <SoftwareSerial.h> 
#include <SparkFunESP8266WiFi.h>
#include <WiFi.h>
//////////////////////////////
// WiFi Network Definitions //
//////////////////////////////
// Replace these two character strings with the name and
// password of your WiFi network.
const char mySSID[] = "*****";
const char myPSK[] = "****";
int status = WL_IDLE_STATUS;

char server[] = "<site>.azurewebsites.net";    // name of the server
WiFiClient client;


void setup() 
{
  // Serial Monitor is used to control the demo and view
  // debug information.
  Serial.begin(9600);
 
  serialTrigger(F("Press any key to begin."));

  // initializeESP8266() verifies communication with the WiFi
  // shield, and sets it up.
  initializeESP8266();

  // connectESP8266() connects to the defined WiFi network.
  connectESP8266();

  // displayConnectInfo prints the Shield's local IP
  // and the network it's connected to.
  displayConnectInfo();

   Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("connected to server");
    // Make a HTTP request:
    client.println("GET /adddata?first=324324");
    client.println("Host: <site>.azurewebsites.net");
    client.println("Connection: close");
    client.println();
  }
  

}

void loop() 
{
 
 while (client.available()) {
    char c = client.read();
    Serial.write(c);
  }

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

     do nothing forevermore:
    while (true);
  }

}

Are you redacting your site name? Or is it really using < and >?

redacting - lets say for example it is arduinotest.azurewebsites.net

ghornet:
redacting - lets say for example it is arduinotest.azurewebsites.net

The host name and the web site name are not the same thing. I suspect that you want to connect to azurewebsites.net (where the web site. and a bazillion others) are hosted. Then, you want to use to arduinotest.azurewebsites.net as the host name, to define which part of the file storage on that machine is actually hosting your file(s).

k - I changed the server and removed the sitename prefix

char server[] = "azurewebsites.net";    // name of the server

I left the hostname call as

 client.println("Host: <site>.azurewebsites.net");

Client.connect is still never confirming that it is connecting to the server.

Thanks for helping me through this.

Is there a way to add debug code to help diagnose?

The first thing to do is to try to connect to a server that hosts ONE domain, like google. If that fails, you have one problem. If that works, you have another. Which problem are we trying to solve?