【问题标题】:Get contents of a url using Proxy, in php but without curl使用代理获取 url 的内容,在 php 中但没有 curl
【发布时间】:2010-07-22 11:15:41
【问题描述】:

我必须使用列表中的代理来获取某些 url 的内容。

所有代理都需要身份验证(我也有用户名和密码)。

问题是我没有在服务器上安装 curl,所以不能使用 curl。

我尝试使用套接字,但使用时遇到问题。

感谢任何帮助。

【问题讨论】:

  • 你的插座有什么问题?

标签: php sockets proxy


【解决方案1】:

stream_context_createproxy 选项一起使用(有关详细信息,请参见此处:http://www.php.net/manual/en/context.http.php)。然后您可以使用标准函数fopenfile_get_contents 访问该文件。

【讨论】:

    【解决方案2】:

    试试这个:

    $text = file_get_contents('http://www.example.com/');
    

    $text = file_get_contents('http://user:pass@www.example.com/');
    

    【讨论】:

      猜你喜欢
      • 2011-04-05
      • 1970-01-01
      • 2016-11-08
      • 2018-03-07
      • 2018-09-09
      • 2013-07-18
      • 1970-01-01
      • 1970-01-01
      • 2016-05-28
      相关资源
      最近更新 更多