Oct
12
2008
12
2008
PHP Script to find visitor’s location
Hello All
Here is a simple php script that lets you track the location of the visitor’s on your site.
Lets get to the code straight away :
<?
$ip = '59.93.196.219';
$url = "http://www.ipmango.com/api.php?ip=".$ip;
$xml = simplexml_load_file($url);
echo "IP address : {$xml->ipaddress}";
echo "City : {$xml->city}";
echo "Region : {$xml->region}";
echo "Country Name : {$xml->countryname}";
echo "Latitude : {$xml->latitude}";
echo "Longitude : {$xml->longitude}";
?>
So basically what we did was, used the free geo ip api from IPMango
The syntax being http://www.ipmango.com/api.php?ip=a.b.c.d where a.b.c.d is the ip address.
Popularity: 6% [?]
Leave a comment
Subscribe
Recent Posts
- Compile wxwebconnect on Ubuntu 11.04 64 bit
- Disqus Comments Importer Script in PHP
- Beginners’ guide to socket programming with winsock
- Handle multiple socket connections with fd_set and select on Linux
- Beginners guide to socket programming in C on Linux
- Gui whois client in python with wxpython
- Whois client code in C with Linux sockets
- str_replace for C
- Easy to use C/C++ IDE for Ubuntu Linux
- Get local ip in C on linux
Binarytides
Tags
apache
applications
box2d
bsnl
c
chrome
cron
css
database
dns
firefox
flash
freelance
game programming
gd
graphs
hacking
htaccess
html
html5
imagemagick
java
javascript
libpcap
linux
mod rewrite
moneybookers
mootools
mvc
mysql
networking
payment
paypal
php
phpmyadmin
python
ruby
security
Sockets
software
swing
ubuntu
winpcap
winsock
xdebug
An article by Binary Tides




