-
Notifications
You must be signed in to change notification settings - Fork 0
/
cuisine_on.php
19 lines (15 loc) · 1.19 KB
/
cuisine_on.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$deviceid = "1000b52986";
$deviceip = "192.168.2.181";
$devicestatus = "on";
$data_string='{"deviceid": "' . $deviceid . '", "data": { "switch": "' . $devicestatus . '" }}';
$ch = curl_init('http://' . $deviceip . ':8081/zeroconf/switch');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$result = curl_exec($ch);
?>