PHP curl返回curl_errno 3

时间:2016-03-10 10:15:31

标签: php php-curl

这是我的PHP代码,当我运行它。它返回我error_no是3。  我无法弄清楚发生了什么。

 $curl = curl_init();
        curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
        curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
        curl_setopt($curl, CURLOPT_HEADER, false);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($param));            
        curl_setopt($curl, CURLOPT_URL, $url);
        //echo http_build_query($param);
        $response = curl_exec($curl);
        $errorCode = curl_errno($curl);

1 个答案:

答案 0 :(得分:1)

error_no 3是CURLE_URL_MALFORMAT,因此请检查您使用的网址是否正确http://php.net/manual/en/function.curl-errno.php#103128