You were never here, you didn't see anything..

Remote IP Display


Getting the IP of a remote machine that requests a page via PHP is simple. On top of that there are services on the web where you can do it. whatismyip.com or ipecho.net are two of the more popular among them.

The purpose of this however is to provide myself with my own means of getting an external IP while I am out running around or at home without running in to any limitations. Plus why provide another site with hits and have adds crammed down my internet pipe if I can do this myself? I prefer a bit of self reliance…

On to some simple PHP code:

<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip;
?>

Simple snippet of code saved in to a file all by itself and served up by a PHP capable web server. The page is found on this site here! Curerntly publicly accessible and with no limits.

It is very spare in that it will simply output the IP address of the requester. It makes no attempt to deal with proxies or any other fancy network shenanigans. The goal is to have output that can be pulled via a script using say curl or wget.

Have any Question or Comment?

2 comments on “Remote IP Display

Andrew

Thanks!

It’s good to have several alternatives, but I think both sites are allowing you to do just that.

For whatismyip.com, search for “whatismyip.com automation” on google (I don’t remember the exact details).

While for ipecho.net there’s http://ipecho.net/developers.html which tells you about http://ipecho.net/plain

Reply

Indeed both allow you to pull the external IP. The point for myself however is why provide hits to and rely on a service provided by someone else why I can do it myself?

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!