V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
yanyuechuixue
V2EX  ›  问与答

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

  •  
  •   yanyuechuixue · May 25, 2014 · 5592 views
    This topic created in 4365 days ago, the information mentioned may be changed or developed.
    curl用于访问目标网页,目标网页会判断IP,对IP有限制数,比如一个IP只能同时访问1次啥的。
    所以想指定IP出口,通过不同的出口就能办到用不同的IP同时访问。
    我知道用fsockopen可以办到,但不知道怎么用curl办到。。。
    5 replies    2020-03-05 09:15:46 +08:00
    leecade
        1
    leecade  
       May 25, 2014
    http_proxy=http://192.1.1.1 curl ...
    这样?
    47jm9ozp
        2
    47jm9ozp  
       May 25, 2014   ❤️ 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
       May 25, 2014
    @leecade 肯定不是的吧!!!!
    yanyuechuixue
        4
    yanyuechuixue  
    OP
       May 25, 2014
    @ooxxcc 谢谢~~~
    hanguoshuai
        5
    hanguoshuai  
       Mar 5, 2020
    @ooxxcc 专门注册账号,等待两小时,道声谢谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5967 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 57ms · UTC 03:27 · PVG 11:27 · LAX 20:27 · JFK 23:27
    ♥ Do have faith in what you're doing.