Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $device = 'ruth_1';
- $user = 'admin';
- $resource = 'led';
- $authorization = 'auth key from api explorer';
- $state = ($_GET['state']=='true')?true:false;
- $url = "host/v2/users/{$user}/devices/{$device}/{$resource}?authorization={$authorization}";
- $data = array(
- 'in' => $state
- );
- $options = array(
- 'http' => array(
- 'method' => 'POST',
- 'content' => json_encode( $data ),
- 'header'=> "Content-Type: application/json\r\n" .
- "Accept: application/json\r\n"
- )
- );
- $context = stream_context_create( $options );
- $result = file_get_contents( $url, false, $context );
- $response = json_decode( $result );
- ?>
Add Comment
Please, Sign In to add comment