Hi,
I’m a French enthusiast for electronics and particle device & services.
I hope my English is understandable.
I have created a web app which allow me to read some value from a core/photon.
Now I would like to save theses data in a SQL database every minute without the web app.
From what I saw in the particle forum & documentation I should use this flow:
The link between the php script and My SQL Database is working.
But I’m not sure of the methode to get data from JSON.
here is my PHP code for that ;
$Data = explode('_',$_GET['Data']);
$DateAjout = date ('Y-m-d H:i:s');
$Temperature = $Data[0];
$Humidite = $Data[1];
$Luminosite = $Data[2];
The JSON object come from a webhook I successfully created with the partile cli.
I’ve used this tutorial and here is my code for the JSON file :
{
"eventName": "SaveToDataBase",
"url": "https://mathieubertecreations.com/LectureCoreData.php",
"requestType": "POST",
"DataFromPhoton":
{
"temperature": "{{PHOTON_TEMPERATURE}}",
"humidite": "{{PHOTON_HUMIDITE}}",
"luminosite": "{{PHOTON_LUMINOSITE}}"
},
"mydevices": true
}
On my core I use this function :
sprintf(publishString, "{ \"PHOTON_TEMPERATURE\": %u,\"PHOTON_HUMIDITE\": %u, \"PHOTON_LUMINOSITE\": %u }", temperature, humidite, light);
Particle.publish("SaveToDataBase", publishString);
The problem is that the dashboard send me an error as you can see :
For me the publish fucntion is working but my webhook doesn’t.
Do you have an idea why this is not working ?
Is it because of my php code or my webhook code ?
Thanks for your help