Javascript turn on led

Now receive it:

Program Start
Executing Curl Operation
Curl Result: ''
Program End

How about you change your access token and device ID to dummy values and change the `$url = …" to

$url = 'http://requestb.in/11fj1ll1' . $deviceID . '/' + $deviceFunction ;

Run it and then let me know so I can look at the request?

crazy, nothing received

How about something simple, like this:

<?php
$result = file_get_contents('http://requestb.in/11fj1ll1');
echo $result;
?>

Perhaps curl is disabled on your server?

An OK message received

I found that curl code working in my computer, but it get an information from spark

    $url = 'https://api.spark.io/v1/devices/aaaaaa/result/?access_token=aaaaaaaa';
    //  Initiate curl
    $ch = curl_init();
    // Disable SSL verification
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    // Will return the response, if false it print the response
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    // Set the url
    curl_setopt($ch, CURLOPT_URL,$url);
    // Execute
    $result=curl_exec($ch);
    // Closing
    curl_close($ch);

Ah, I was thinking that perhaps it didn’t like the SSL part. I updated the gist. Give that a try

made the test, nothing yet

Well, I do apologize. I will test this when I get home and get it working. I’ll reply when I do

[Edit] Should be free in about 2 to 3 hours

Ok thank you very much, I’m waiting for your answer.

Sorry for the late response. I got… distracted ( http://community.spark.io/t/phpspark-interacting-with-the-spark-cloud-spark-io-using-php/10617/1 )

This should work for you (modify as your see fit)

<?php
// Include the required files. You will need to rename phpSpark.config.sample.php to phpSpark.config.php and then set the values within to use this example
if((@include 'phpSpark.class.php') === false)  die("Unable to load phpSpark class");
if((@include 'phpSpark.config.php') === false)  die("Unable to load phpSpark configuration file");

// Grab a new instance of our phpSpark object
$spark = new phpSpark();

// Set the internal debug to false. Note, calls made to $spark->debug(...) by you ignore this line and display always
$spark->setDebug(false);
// Set the debug calls to display pretty HTML format. Other option is "TEXT". Note, calls made to $spark->debug(...) display as set here
$spark->setDebugType("HTML");

// Set our access token (set in the phpConfig.config.php file)
$spark->setAccessToken($accessToken);

// Call a Spark Function
$spark->debug("Spark Function");
if($spark->doFunction($deviceID, "led", "l,HIGH") == true)
{
    $spark->debug_r($spark->getResult());
}
else
{
    $spark->debug("Error: " . $spark->getError());
    $spark->debug("Error Source" . $spark->getErrorSource());
}
?>

Hello,

I received this messages::

Spark Function

Notice: Undefined property: phpSpark::$disableSSL in …\phpSpark.class.php on line 406

Error: Unable to parse JSON. Json error = 0. See http://php.net/manual/en/function.json-last-error.php for more information. Raw response from Spark Cloud = ‘’

Error SourcedoFunction

Thanks for catching that. You have your PHP enviroment set quite strict (which is good). I pushed an update to the repo. Let me know if that doesn’t fix the problem for you.