Search code examples
phpcurlnode-red

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.

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

Solution

  • 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