1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Is it possible to define the IP as something other than the actual visitor's IP?

Discussion in 'PHP & Perl' started by OTrap, Jun 21, 2014.

  1. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,286
    Likes Received:
    1,052
    This might seem like an odd question, so I suppose I should explain.

    I have a database of legitimate data. I'm trying to use that data to submit forms via a Javascript form autosubmit. However, in order to get it to fire, I'm using cheap traffic. I'd prefer to use the actual IP addresses I have for the data instead of the IP addresses from the traffic.

    Is it possible to set the IP address via PHP? If so, how?

    Thanks in advance, guys!
     
  2. Daagur

    Daagur Newbie

    Joined:
    Aug 22, 2012
    Messages:
    33
    Likes Received:
    60
    Home Page:
    Short answer: No, not without using a proxy/vpn

    Long answer:
    Yes it is possible. But it's not that easy.
    The problem is that your php program and the http requests it sends operate on the highest layer of the OSI Model (Layer 7). Your requests will move from layer 7 to layer 1 and each layer will add new headers to the request. The ip address is added on layer 3, so you would need to do all the networking stuff by yourself (open a socket, forge all needed headers...). I don't know if this is even possible in php since all of phps socket functions operate on a more or less high abstraction layer. However there will still be a problem when you are doing this: You won't receive any responses from the server, since they will be sent to the the fake ip

    Another way would be to fake the 'HTTP_X_FORWARDED_FOR' header. This header is set from some proxies and contains your real ip address. Problem is that most web apps won't check this header, or, if they do, won't rely on its values

    If you want some deeper information, ask google about IP Spoofing
     
    • Thanks Thanks x 1
  3. OTrap

    OTrap Jr. VIP Jr. VIP

    Joined:
    Jul 12, 2008
    Messages:
    2,286
    Likes Received:
    1,052
    I appreciate the help and candor in explaining.