curl through proxy returns no content

前端 未结 3 1315
难免孤独
难免孤独 2021-01-03 03:09

I\'m working on a PHP script right now which sends requests to our school\'s servers to get real-time information about class sizes for different courses. The script runs pe

3条回答
  •  天涯浪人
    2021-01-03 03:40

    I use the following code if I have to use a proxy with curl:

    $proxy = "127.0.0.1:8080"; // or something like that
    
    if($proxy !== null){
    
        // no need to specify PROXYPORT again
        curl_setopt($ch, CURLOPT_PROXY, $proxy);
    
        // to make the request go through as though proxy didn't exist
        curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0);
    
    }
    

提交回复
热议问题