Retrieve IP

Discussion in 'PHP' started by Mr.Bill, Jun 11, 2008.

  1. #1
    Not sure if this can be done with PHP or if its another language.

    Would like to know how to retrieve this information

    Private & Public IP

    So it can show it on a website. Is this possible with PHP?
     
    Mr.Bill, Jun 11, 2008 IP
  2. sky22

    sky22 Guest

    Messages:
    59
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello,

    Do you mean get the IP of a visitor?

    That can be done with:

    $ip = $_SERVER['REMOTE_ADDR'];
    PHP:
    or do you mean get the IP of a server or something else?

    Sky22
     
    sky22, Jun 11, 2008 IP
  3. for_si2003

    for_si2003 Banned

    Messages:
    399
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Do you want something like this

    http://getyrip.com ?

    I can get you the code in PHP ...
     
    for_si2003, Jun 11, 2008 IP
  4. Mr.Bill

    Mr.Bill Well-Known Member

    Messages:
    2,818
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    160
    #4
    Yes, the IP of the visitor I can find how to get the IP but not there IP if behind a router. So need a way to fetch both IPs

    edit*** those are getting the private IP not the public IP
     
    Mr.Bill, Jun 11, 2008 IP
  5. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #5
    It's impossible to retrieve the private (networked IP), as the router controls packets as it crosses it and all requests from any router will contain only the public (ISP) IP address.
     
    jayshah, Jun 11, 2008 IP
  6. sky22

    sky22 Guest

    Messages:
    59
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    sky22, Jun 11, 2008 IP
  7. Mr.Bill

    Mr.Bill Well-Known Member

    Messages:
    2,818
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    160
    #7
    Would something to this effect do it?

    Doesnt work for me but might have a space or something that is out of place.


    Actually disregard this I will ask the owner of the script if he will share the asp code he used. Hoped it could be in php
     
    Mr.Bill, Jun 11, 2008 IP
  8. jayshah

    jayshah Peon

    Messages:
    1,126
    Likes Received:
    68
    Best Answers:
    1
    Trophy Points:
    0
    #8
    The code is for proxies, i.e. tunnelling your HTTP requests over a (transparent) HTTP proxy.
     
    jayshah, Jun 11, 2008 IP