Created
May 28, 2015 21:38
-
-
Save mager/ffd42619ba14e5991006 to your computer and use it in GitHub Desktop.
Twilio to SmartApp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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