0

I have the following code to set the color of a Philips lightbulb.

<?php

$arrData['hue'] = 46920;
$arrData['sat'] = 254;
$arrData['bri'] = 254;

$data = json_encode($arrData);
echo $data;

$url = "http://MYSITE/api/1234567890/lights/1/state";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PORT, 8078);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");

$response = curl_exec($ch);
echo $response; 

?>

I essentially want to make a PUT request {"hue":46920,"sat":254,"bri":255} to http://MYSITE:8078/api/USER/lights/1/state except it just times out. Here is the output of the clip API debugger

enter image description here

What am I doing incorrect?

Bijan
  • 7,737
  • 18
  • 89
  • 149

0 Answers0