Spark Core sending Data to Spark Dashboard and local webServer


I’m developing a Cloud Service, Right now i’m capturing data from Spark via Curl. But I want it to send data to a local LAMP server.
I’m very new on spark developing so I need some help


Here’s Is the code I’m Using and it’s working, But can’t send data to the Lamp Server

Hi @luiscd7

So if I am understanding you right, the sensor part of your code is working fine but the HTTP POST request is not working. Is that right?

Looking at your loop, you do three POST requests:

void loop()
    //bySensorVal = map(iSensorValue, 0, 1023, 0, 100);
    request.path = "";
    request.body = "{\"value\":" + String(smoke) + "}";, response, headers);
    request.path = "";
    request.body = "{\"value\":" + String(t) + "}";, response, headers);
    request.path = "";
    request.body = "{\"value\":" + String(h) + "}";, response, headers);

What do you get back from these? What is printed by the Serial.println(response.body)?

Have you tried doing these using postman (a Chrome extension) or curl (a command line tool) to make sure you have the format exactly right?

i try to send code with my laptop manually and it works.
right now with all the mods the code doen’t compile.
I would like it to send data to the host via get or post.
but now it’s not working at all the code

Does this mean you tried with postman or curl or did you just try using an HTML form as a user?

If you run say curl with -v option (or many other ways) you can see exactly what your POST request looks like to the host. You can also use a reflection service with the posts from your core to see how they look to web host.

I know that @harrisonhjones has done some work with this.

Maybe you should work on a “just POSTing” version of your code that just tries put static values onto the web and then come back and add in the sensor part later on.

@luiscd7 I’m one of the engineers behind the Spark Dashboard. In order to see data from this Core on your dashboard, you will need to be publishing events using Spark.publish() from your device. Without doing this in your firmware, the only events that will appear in your event stream are online and offline events.

Thanks, i’m sending data already to spark dashboard. I want to send data to a lamp server too. Could you please check the code i’m using. The code was developed with the help of @harrison.