dragon201401 2018-01-14 18:51
浏览 667

CURL无法解决CURLOPT_PROXY服务器问题?

I am trying to use Luminati.oi proxy service to crawl URLs but there seems to be a problem with my server connecting to the proxy and utilizing the CURLOPT_PROXY functionality.

 $curl = curl_init('http://lumtest.com/myip.json'); 
 curl_setopt($curl, CURLOPT_PROXY, 'http://example:24000');       
 curl_exec($curl);

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

 echo 'Curl error: ' . curl_error($curl); 
 curl_close($curl);

I get no response at all from the target URL and the curl_error() function returns Curl error: Failed to connect to exmaple port 24000: Connection refused there are several variations on how to compose the CURL that Luminati.io provides, none seem to work.

If I remove the CURLOPT_PROXY option and just send the request direct from my server with no proxy, it works just fine and I get the correct response back from the target URL. So my server seems okay with CURL just not the proxy function.

The URL and port for the proxy server at luminati.io seem to work fine when using the desktop proxy manager. So the proxy service seems to work okay, the target URL is good and my server can use CURL with no problem, so it seems the issue is isolated around the CURLOPT_PROXY not working. The good people over at Luminati.io think there is some type of server setting or firewall in my Apache Linux server that wont allow the proxy connection to occur, I can't find this setting anywhere and Hostgator seems useless and apathetic when asked.

So I'm hoping someone can provide some greater insight into why CURLOPT_PROXY function wont work.

  • 写回答

1条回答 默认 最新

  • dougang2749 2018-01-25 08:31
    关注

    You can ask Hostgator to give you access to port 22225. I think this is the correct port used by Luminati.

    This is how you can contact Hostgator: http://support.hostgator.com/articles/open-new-ports

    评论

报告相同问题?

悬赏问题

  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块