Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php Curl error: Failure when receiving data from the peer

Tags:

php

curl

I had a basic Curl script which basically executed a script on remote server. I was working fine from around 6 months.

Yesterday it stopped working, and was giving back following error.

Curl error: Failure when receiving data from the peer

Would like to know if anyone knows on which condition the curl would returned such error?

like image 227
jtanmay Avatar asked Dec 28 '22 13:12

jtanmay


1 Answers

When dealing with problem with curl, run it again with:

curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR,  fopen('php://output', 'w'));

Usually the exact error message is in there somewhere.

Fixed: CURLOPT_STDERR indeed needs a stream resource as @Lübnah states in the comments, and @Roman tried to edit in (although earlier reviewers denied the edit, I've now included it in the answer).

like image 134
Wrikken Avatar answered Dec 31 '22 02:12

Wrikken