dse323222 2015-05-01 07:20
浏览 35

PHP提出请求Philips Hue

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?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序