【发布时间】:2017-03-12 17:26:00
【问题描述】:
编辑:正确的做法是从 Node-red 发送响应,如下面的 hardillb 指出的那样。
我的 CURL 请求可以立即正常工作,但我只需要让页面访问 url 而不是等待响应。我已经尝试了所有我能想到的组合,但我的浏览器仍然等待服务器响应直到超时。
$url = 'http://example.com:1880/get?temperature='.$temperature;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 1);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
// 3. execute and fetch the resulting HTML output
$output = curl_exec($ch);
// 4. free up the curl handle
curl_close($ch);
}
【问题讨论】:
-
为什么不等待回复呢?您是否忘记在 Node-RED 流中添加 http-response 节点?
-
你是绝对正确的 hardillb,只有响应表单节点红色更容易。我不知道为什么我从来没有注意到左边的那个。
-
至于其他帖子...我很欣赏这些链接。当响应为零时,我刚刚从 CURL 得到混合结果。感谢大家的宝贵时间!