CodeCrafter

Untitled

Feb 23rd, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2. $url = 'http://192.168.1.190/api/SUsc-E6wbcfoFbd7TLTOFTRB3hTny2pHTilHJhXe/groups/0/action';
  3.  
  4. $data = array("alert"=>"select");
  5. $data = json_encode($data);
  6.  
  7. // use key 'http' even if you send the request to https://...
  8. $options = array(
  9. 'http' => array(
  10. 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
  11. 'method' => 'PUT',
  12. 'content' => http_build_query($data)
  13. )
  14. );
  15. $context = stream_context_create($options);
  16. $result = file_get_contents($url, false, $context);
  17. if ($result === FALSE) { /* Handle error */ }
  18.  
  19. var_dump($result);
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment