basically, this error only occurs in CURL
curl: (56) Recv failure: Connection reset by peer
But when I visit it directly the link directly on my browser, it works!
What are your recommendations on fixing this one or the cause of this error?
Note: the server is coded in ASP and it only occurs on one API Call
The Curl error 56 means there's an error on the hosts' side. It could be a server-side restriction or a loopback error on the server (if they say they don't allow loopbacks, then that's the culprit in your case).
Connection Reset by peer means the remote side is terminating the session. This error is generated when the OS receives notification of TCP Reset (RST) from the remote server.
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));
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:
I was trying to pass the query parameters in the URL directly and I tried passing through POST method
I tried using a proxy with curl to see if I was possibly being blocked by the other server
I believe I also asked my host to look into it and they made some Apache setting changes
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