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

后端 未结 3 1049

basically, this error only occurs in CURL

curl: (56) Recv failure: Connection reset by peer

But when I visit it directly the link directly

3条回答
  •  甜味超标
    2020-12-17 19:36

    I had similar problem with this code:

            $url = "http://xxx.xxx.xxx.xxx";
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_PORT, 44455); //Set the port to connect to
            //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 44455); 
            curl_setopt($ch, CURLOPT_URL, $url);
            echo $xml = curl_exec($ch);
            if(curl_errno($ch))
            {
                echo 'error:' . curl_error($ch);
            }
            curl_close($ch);
    

    Got it solved by disabling this:

            //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 44455);
    

提交回复
热议问题