Skip to content

Instantly share code, notes, and snippets.

@mdestafadilah
Created March 26, 2021 03:19
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 mdestafadilah/259b82ed02d6737aab477488cffc6f29 to your computer and use it in GitHub Desktop.
Save mdestafadilah/259b82ed02d6737aab477488cffc6f29 to your computer and use it in GitHub Desktop.
SCALEDRONE
$channel_id = "K3gfQWyPfnlARdfu";
$channel_secret = "ilQTV3cM7LzSqS9QM4RBudK38Ohdvnai";
$room_name = "surat";
$auth = base64_encode("$channel_id:$channel_secret");
$url = "https://api2.scaledrone.com/$channel_id/$room_name/publish";
$data = array('key1' => 'value1', 'key2' => 'value2');
$options = array(
'http' => array(
'header' => array(
"Content-type: application/json",
"Authorization: Basic $auth",
),
'method' => 'POST',
'content' => json_encode($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) { /* Handle error */ }
var_dump($result);
exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment