how to find external IP add.
Results 1 to 7 of 7

Thread: how to find external IP add.

  1. #1

    Angry how to find external IP add.


    I am writting a program to find the external IP address of the client computer, I want to know what code the guy at uses to display the IP of the computer making the request which I am interested in using in my site+program.


  2. #2
    first glance at the webpage i thought itd be a javascript, but when i looked at page's source code, i couldn't find the line, so i went to the next place and found a javascript that would show the viewer's ip address:

      1.  Copy the coding into the HEAD of your HTML document  -->
    <!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->
    <SCRIPT LANGUAGE="JavaScript">
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! -->
    <!-- Begin
    // Depending on your server set-up,
    // you may need to use the ".shtml"
    // extension [instead of the "html"
    // or "htm"] as the script uses Server
    // Side Includes. To display in the
    // title bar, exclude the
    //"<title></title>" code from the page.
    // This part gets the IP
    var ip = '<!--#echo var="REMOTE_ADDR"-->';
    // This part is for an alert box
    alert("Your IP address is "+ip);
    // This part is for the status bar
    window.defaultStatus = "Your IP address is "+ip;
    // This part is for the title bar
    document.write("<title>Your IP address is "+ip+"</title>");
    //  End -->
    <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
    by <a href="">The JavaScript Source</a></font>
    <!-- Script Size:  1.09 KB -->

  3. #3
    Junior Member
    Join Date
    Dec 2003
    They did use javascript at, but there is an easier way but requires more.

    PHP is an easy language for things like this because its a lot less code and does so much more, but it does require php installed on the server.

    Example page:

    echo "<p>Your ip is $REMOTE_HOST</p>"

    And the browser output would be:

    Your ip is (this would actually be your real ip)

    Hope that helps, PHP is very useful

    PHP links:

    PHP Homepage
    A nice site to learn from

    - DeathIncarnate
    cout<<\"Cmon, its not that hard...\\n\\nDeathIncarnate\\n\\n\";
    return 0;

  4. #4
    AO Antique pwaring's Avatar
    Join Date
    Aug 2001
    That PHP code won't work on newer versions of PHP, because register_globals is off by default (and rightly so). You'd need to replace $REMOTE_HOST with $_SERVER['REMOTE_HOST'] in order for it to work.
    Paul Waring - Web site design and development.

  5. #5
    Is there any way to do it in CGI/Perl?


  6. #6
    Elite Hacker
    Join Date
    Mar 2003
    this should help
    you should try searching google for "getting ip with cgi". That's how I got that page. Good luck.

  7. #7
    Junior Member
    Join Date
    Dec 2003
    use CGI qw(:standard);

    print "Content-type:text/html\n\n";
    print "Your IP address is: ".$ENV{REMOTE_ADDR};

    #I love you Perl...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts