简体   繁体   English

强制CURL请求不查找响应PHP

[英]Force CURL request to not look for a response PHP

EDIT: The proper thing to do is just to send a response from Node-red as hardillb pointed out below. 编辑:正确的做法是从Node-red发送响应,如下面指出的hardillb。

My CURL request is working fine and instantly, but I simply need to have the page visit the url and not wait around for a response. 我的CURL请求工作正常,但我只需要让页面访问网址而不是等待响应。 I have tried every combination I can think of and my browser still sits waiting for a server response until timeout. 我已经尝试了我能想到的每一个组合,我的浏览器仍在等待服务器响应,直到超时。

$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);
}

As mentioned in the comments. 正如评论中所提到的那样。

The correct solution is to ensure your http-in node is paired with a http-response node in your Node-RED flow 正确的解决方案是确保您的http-in节点与Node-RED流中的http响应节点配对

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM