Setting up an agent problem when using curl!

Code first

 public static function curl_get_https($url){
        echo $url;
        $curl = curl_init(); // CURL
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_HEADER, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);  // SSL

        curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($curl,CURLOPT_PROXY,"123.163.160.171");
        curl_setopt($curl,CURLOPT_PROXYPORT,"8787");
        curl_setopt ($curl, CURLOPT_TIMEOUT, 20);

        $tmpInfo = curl_exec($curl);     //apijson

        curl_close($curl);
        return $tmpInfo;    //json
    }

execute Times error message

Proxy CONNECT aborted due to timeout

Mar.10,2021

is this a local test? If so, try changing the proxy address to 127.0.0.1


the proxy server cannot connect


try this code

$proxy = "80.25.198.25";
$proxyport = "8080";
$ch = curl_init("http://sfbay.craigslist.org/");

 

curl_setopt($ch, curlOPT_RETURNTRANSFER,1);
curl_setopt($ch,curlOPT_proxy,$proxy);
curl_setopt($ch,curlOPT_proxyPORT,$proxyport);
curl_setopt ($ch, CURLOPT_TIMEOUT, 120);

 

$result = curl_exec($ch);
echo $result;

curl_close($ch);

your error indicates that the proxy server connection timed out.
it is recommended to test it with the curl command line tool to make sure that the agent is available and supports HTTPS before porting to the php code, such as
curl-x 123.163.160.171br 8787 https://www.baidu.com

  • Problems with using agents in PHP CURL

    has been implementing a feature recently. Use php curl to submit data to post to query a station to query the order page (because the function of the station is not open to api, so I want to use curl to simulate the form to submit the query). After writi...

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2be5f-2a816.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2be5f-2a816.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?