Skip to content

Instantly share code, notes, and snippets.

@mager
Created May 28, 2015 21:38
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 mager/ffd42619ba14e5991006 to your computer and use it in GitHub Desktop.
Save mager/ffd42619ba14e5991006 to your computer and use it in GitHub Desktop.
Twilio to SmartApp
<?php
$url = 'https://graph.api.smartthings.com/api/smartapps/installations/dc20d3c1-7573-4fe2-9e13-ac095c4eb20e/hue';
//$data = array('text' => 'color=orange');
$body = $_REQUEST['Body'];
$data = "{'value':'$body'}";
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Authorization: Bearer 19a2db56-2ab1-4d97-a8bd-fd15decb7207\nContent-type: application/json",
'method' => 'PUT',
'content' => $data,
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
//var_dump($result);
?>
<Response>
<Message>Thanks for coming to our Minneapolis Office Opening Meetup!</Message>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment