V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
yanyuechuixue
V2EX  ›  问与答

多 IP 服务器,用 php 里的 curl 如何指定 ip 出口?

  •  
  •   yanyuechuixue · 2014-05-25 19:49:38 +08:00 · 5065 次点击
    这是一个创建于 3622 天前的主题,其中的信息可能已经有所发展或是发生改变。
    curl用于访问目标网页,目标网页会判断IP,对IP有限制数,比如一个IP只能同时访问1次啥的。
    所以想指定IP出口,通过不同的出口就能办到用不同的IP同时访问。
    我知道用fsockopen可以办到,但不知道怎么用curl办到。。。
    5 条回复    2020-03-05 09:15:46 +08:00
    leecade
        1
    leecade  
       2014-05-25 19:56:53 +08:00
    http_proxy=http://192.1.1.1 curl ...
    这样?
    ooxxcc
        2
    ooxxcc  
       2014-05-25 20:02:29 +08:00   ❤️ 1
    CURLOPT_INTERFACE
    The name of the outgoing network interface to use.
    This can be an interface name, an IP address or a host name.

    curl_setopt($handle, CURLOPT_INTERFACE,"127.0.0.1" );
    yanyuechuixue
        3
    yanyuechuixue  
    OP
       2014-05-25 20:39:25 +08:00
    @leecade 肯定不是的吧!!!!
    yanyuechuixue
        4
    yanyuechuixue  
    OP
       2014-05-25 20:48:23 +08:00
    @ooxxcc 谢谢~~~
    hanguoshuai
        5
    hanguoshuai  
       2020-03-05 09:15:46 +08:00
    @ooxxcc 专门注册账号,等待两小时,道声谢谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5412 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 07:44 · PVG 15:44 · LAX 00:44 · JFK 03:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.