Hello,
I just created a simple PHP page to store the values into the sql database, but for some reason my Spark won’t send the data, I just created this simple code to make sure the Core can post it, but no luck. My php file works good because if I go on the browser and type this address with any values like this:
http://www.domain.com/Sensor/ReceiveDataFromSparkCore.php?Name=Test&Temperature=20&Humidity=30&Value1=1&Value2=200&Value3=1
it will store it in the database, but when I try with the core, nothing.
Can someone help what can possibly be? here is the code I wrote on the Core,
Thank You.
// This #include statement was automatically added by the Spark IDE.
#include "Adafruit_DHT/Adafruit_DHT.h"
// This #include statement was automatically added by the Spark IDE.
#include "HttpClient/HttpClient.h"
TCPClient client;
char server[] = "www.domain.com";
void setup()
{
Serial.begin(9600);
}
void loop()
{
delay(2000);
Serial.println("Hello Computer");
if (client.connect(server, 80)) {
Serial.println("connecting...");
client.println("GET /Sensor/ReceiveDataFromSparkCore.php?Name=Test&Temperature=90&Humidity=50&Value1=1&Value2=200&Value3=1 HTTP/1.1");
client.println("Host: ");
client.println("Connection: close");
delay(5000);
}
else {
// Serial.println("Connection failed");
// Serial.println("Disconnecting.");
client.stop();
}
}
I’ve edited your post to properly format the code. Please check out this post, so you know how to do this yourself in the future. Thanks in advance! ~Jordy