Question by Radosław:
I’m building people counter based on ESP8266,PIR sensor and Ubidots.
The easiest solution is to send value of “1” every each detection and create summing widget (of a last month). I dont want to send last value +1 because I’ll need to erase the values every each month so it’ll show me only current month’s values.
Everything is working so far, but I’d like to save the value of “sum of last month” widget at the last day of every each month to create (automatized) statistics, so I used cron & php curl for that, problem is: this is not working as intended, Im getting back page without the divs with data: http://alu.net.pl/test_zapis/?save=ok (right now it only echoes the curl result, so you can check for yourself).
How can I save the data from the widget div and save it automaticly ? is there any API for that?
Here is widget itself:
Ubidots |
and here is php code:
$url = "https://app.ubidots.com/ubi/getchart/page/mc9_s6971pJP1pmAhqbBReTR5Ic/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$retValue = curl_exec($ch);
curl_close($ch);