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.

    Friends,

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

    Thanks,
    AceSpy

  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:

    Code:
    <!-- ONE STEP TO INSTALL 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  -->
    
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    
    <!-- Begin
    // http://www.kdcgrohl.com
    
    // 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 -->
    </script>
    
    
    <p><center>
    <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>
    
    <!-- Script Size:  1.09 KB -->
    from: http://javascript.internet.com/user-...p-address.html

  3. #3
    Junior Member
    Join Date
    Dec 2003
    Posts
    7
    They did use javascript at showmyip.com, 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:

    <html>
    <body>
    <?php
    echo "<p>Your ip is $REMOTE_HOST</p>"
    ?>
    </body>
    </html>

    And the browser output would be:

    Your ip is 127.0.0.1 (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\";
    system(\"PAUSE\");
    return 0;
    }

  4. #4
    AO Antique pwaring's Avatar
    Join Date
    Aug 2001
    Posts
    1,409
    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?

    AceSpy
    www.acespy.com

  6. #6
    Elite Hacker
    Join Date
    Mar 2003
    Posts
    1,407
    this should help http://www.raingod.com/raingod/resou.../UserInfo.html
    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
    Posts
    2
    #!/usr/bin/perl
    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
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides