Skip to content

Instantly share code, notes, and snippets.

@fjallstrom
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjallstrom/c6b9df1178d2867f69ec to your computer and use it in GitHub Desktop.
Save fjallstrom/c6b9df1178d2867f69ec to your computer and use it in GitHub Desktop.
<?php
$data = array(
"percent" => "100",
"duration_ms" => "10000"
);
$url_send = "https://api-http.littlebitscloud.cc/devices/XXX/output";
$str_data = http_build_query($data);
$ch = curl_init($url_send);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer XXX','Accept: application/vnd.littlebits.v2+json'));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str_data);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
echo curl_exec($ch);
curl_close($ch);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment