Data from Arduino sensor to PHP & MySql issue

I can't figure out what I'm missing. I am trying to send data from my sensor to a mysql db without success.

If I change everything from client.XXXXXX to Serial.XXXX then copy and paste the url into a browser, it works like a charm. I'm guessing there is something wrong with my header information. Can anyone help? I've found several threads that follow similar issues, and have tried all suggestions like changing client.println("GET http://xxxxx.bmpdev.com/push.php?xxxxxxxxxxx");

char server[] = "xxxxx.bmpdev.com";
if (client.connect(server, 80)) {

    Serial.println("connecting...");
    // send the HTTP PUT request:
    Serial.println();
    
    client.println("GET /push.php?user=1&rt=");
    client.print(DHT.humidity);
    client.print("&h=");
    client.print(DHT.temperature * 1.8 + 32);
    client.print(" HTTP/1.1");
    client.println("Host: xxxxx.bmpdev.com");
    client.println("Connection: close");
    
    Serial.println("Finished sending data");
    

    // note the time that the connection was made:
    lastConnectionTime = millis();
  }

Sweeeeeet I got it working :slight_smile:

if (client.connect(server, 80)) {

    Serial.println("connecting...");
    // send the HTTP PUT request:
    Serial.println();
    
    client.print("GET http://xxxxx.bmpdev.com/push.php");
    client.print("?user=1&h=");
    client.print(DHT.humidity);
    client.print("&rt=");
    client.print(DHT.temperature * 1.8 + 32);
    client.println(" HTTP/1.1");
    client.println("Host: xxxxx.bmpdev.com");
    client.println();
    
    Serial.println("Finished sending data");
    

    // note the time that the connection was made:
    lastConnectionTime = millis();
  }

Is xxxxx.bmpdev.com your domain, or is bmpdev.com hosting many sites, including xxxxx which is yours?

If bmpdev.com is hosting many sites, you should be able to use:

    client.print("GET /push.php");
    client.print("?user=1&h=");
    client.print(DHT.humidity);
    client.print("&rt=");
    client.print(DHT.temperature * 1.8 + 32);
    client.println(" HTTP/1.1");
    client.println("Host: xxxxx.bmpdev.com");
    client.println();

I'm assuming that you do not have access to the server logs, to see why this didn't appear to work.

Of course, the server provided some response but you didn't share that with us.