I'm trying to upload data with POST to my webserver but sometimes cURL just stalls and causes PHP to use 100% CPU indefinitely.
I'm using the code below.
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $URL);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($curl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)');
curl_setopt($curl, CURLOPT_HEADER, true);
$page = curl_exec($curl);
curl_close($curl);
Any insight to what is causing or how to track this issue would be great.
If it really is the actual curl "call" that hangs and performs 100% CPU, then that is a curl bug and you should probably consider upgrading your libcurl.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With