代码之家  ›  专栏  ›  技术社区  ›  Arshdeep

在php中使用代理获取url的内容,但不使用curl

  •  2
  • Arshdeep  · 技术社区  · 16 年前

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

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

    我试过用插座,但用起来有问题。

    2 回复  |  直到 16 年前
        1
  •  2
  •   Alex    16 年前

    使用 stream_context_create 与 proxy 选项(有关详细信息,请参阅此处: http://www.php.net/manual/en/context.http.php fopen , file_get_contents .

        2
  •  -1
  •   budinov.com    16 年前

    尝试使用以下选项:

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

    或

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