Advertisement
Guest User

Untitled

a guest
Dec 28th, 2014
60
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // create curl resource
  2.     $ch = curl_init();
  3.     curl_setopt($ch, CURLOPT_POST, 1);
  4.  
  5.     // set url
  6.     curl_setopt($ch, CURLOPT_URL, "https://api.spark.io/v1/devices/YOURDEVICEIDHERE/led");
  7.    
  8.     // set oauth access token
  9.     curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('access_token' => 'YOURACCESSTOKENHERE')));
  10.  
  11.     // return the transfer as a string
  12.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  13.  
  14.     // $output contains the output string
  15.     $output = curl_exec($ch);
  16.     print_r($output);
  17.  
  18.     // close curl resource to free up system resources
  19.     curl_close($ch);
Advertisement
RAW Paste Data Copied
Advertisement