PHP CURL Error - curl: (56) Recv failure: Connection reset by peer

I remember facing the same issue a long time back. While I don't remember what exactly sorted out the issue, I remember trying the following:

  1. I was trying to pass the query parameters in the URL directly and I tried passing through POST method

  2. I tried using a proxy with curl to see if I was possibly being blocked by the other server

  3. I believe I also asked my host to look into it and they made some Apache setting changes


I resolved this issue by removing whitespace characters from the URL. In my situation, it was the proxy server that was erroring out, not the web server.

In PHP:

     curl_setopt($ch, CURLOPT_URL, trim($url));

Tags:

Php

Curl