Changing IP in PHP

Discussion in 'PHP' started by hamid.soltani92, Jul 22, 2010.

  1. #1
    Hi every body
    I want to change my ip address in php.let me explain it
    i have this file that contanins an iframe:
    <iframe src="show.php"></iframe>
    Code (markup):
    and this is the show.php
    <?php
    echo $_SERVER['REMOTE_ADDR'].'->'.$_SERVER['HTTP_REFERER'];
    ?>
    Code (markup):
    Now When i open the iframes page,it will show me 127.0.0.1(if file hosted on local) and the address of iframe page
    Now,I want to change the REMOTE ADDR and HTTP REFERRER
    does any body know how can i do it?

    thanks a lot
     
    hamid.soltani92, Jul 22, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    'SERVER_ADDR' is the IP address of the server under which the current script is executing. And 'HTTP_REFERER' is the address of the page (if any) which referred the user agent to the current page.

    Therefore, you simply cannot change it.

    Read this for more information about it.
     
    Rainulf, Jul 22, 2010 IP
  3. ssmm987

    ssmm987 Member

    Messages:
    180
    Likes Received:
    4
    Best Answers:
    3
    Trophy Points:
    43
    #3
    You can't change your ip like that, and there is no need for either.

    If you need to access an external page with a different ip, you need to use proxy stuff...
     
    ssmm987, Jul 22, 2010 IP
  4. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #4
    So basically you want to browse another site from a different IP? You can use cURL for that.
     
    iAreCow, Jul 22, 2010 IP
  5. Deacalion

    Deacalion Peon

    Messages:
    438
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It's not possible to change your IP address. (well technically you could change it to anything, but you wouldn't be allowed on the internet with it - just your own private network)

    Has your ISP assigned you more than one IP address? or do you have a dynamic IP address that changes each time you come online? (in that case you could tell their DHCP server you've released your old one and ask for a new one)
     
    Deacalion, Jul 22, 2010 IP