To beat this topic to death…
I’ve built a simple html website that does four things;
Turn on a spark core red LED
Turn off a spark core red LED
Turn on a spark core blue LED
Turn off a spark core blue LED
On the server side (Apache) I’m calling one of four php scripts (see below) that, using curl, posts to the spark api. These php scripts, when executed server side turn the leds on and off and the response header appears almost instantly.
These scripts are simply called by an HTML “form action” button.
What is driving me crazy is that when the form action button is clicked it’s taking 16 seconds to respond. I’m all over the place on trying to solve this.
No, I’m not a developer but I play on on TV
Any help would be appreciated!<?php $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,"https://api.spark.io/v1/devices/my_device_ID_here/led"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "access_token=my_access_token_here¶ms=l0,HIGH"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_exec ($ch); curl_close ($ch); ?>