Topic: IP Location Script  (Read 1758 times)

0 Members and 1 Guest are viewing this topic.

IP Location Script
« on: May 22, 2012, 07:28:35 AM »
Do you want to know where your Internet visitors are coming from? Which country? Which state? Which city? Which ISP? Which domain name? Which connection type? Which ZIP code? Mobile Carrier Information?

IP2Location is a geo IP solution to help you to identify visitor’s geographical location, i.e. country, region, city, latitude, longitude, ZIP code, time zone, connection speed, ISP and domain name, IDD country code, area code, weather station code and name, and mobile carrier information using a proprietary IP address lookup database and technology without invading the Internet user’s privacy. The database is also being used by Fortune 500 companies.

There are API and Source codes for major languages for the use with the demo database. Download the language scripts below….

    PHP Library
    Ruby Library
    Python Library

For other language API and Source codes, Please visit vendor site at http://www.ip2location.com/default.aspx
Sample Code: PHP

Installation: download the PHP Module and host the files on your server. Open the sample.php file (it should look like the script below). change the getALL(<ipaddress>) to reflect the IP you want to check and thats it.

To make the code more flexible, you could use the HTTP POST/GET in the ip address line script e.g $record = $ip->getAll($_POST['ipaddress']);

<?php

require_once(‘ip2location.class.php’);
$ip = new ip2location;
$ip->open(‘./databases/IP-COUNTRY-SAMPLE.BIN’);
$record = $ip->getAll(’80.248.10.174‘);

echo ‘IP Address: ‘ . $record->ipAddress;
echo ‘IP Number: ‘ . $record->ipNumber;
echo ‘Country Short: ‘ . $record->countryShort;
echo ‘Country Long: ‘ . $record->countryLong;
echo ‘Region: ‘ . $record->region;
?>

Cheers…

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
1198 Views
Last post July 10, 2015, 01:01:22 AM
by clowntom
0 Replies
1050 Views
Last post April 01, 2016, 01:00:30 PM
by olutee
0 Replies
1173 Views
Last post April 01, 2016, 07:00:37 PM
by olutee
0 Replies
673 Views
Last post December 10, 2018, 01:02:30 PM
by PulseNG
0 Replies
1176 Views
Last post September 18, 2019, 01:02:35 PM
by NaijaPilot
0 Replies
2916 Views
Last post November 14, 2019, 01:00:31 PM
by PulseNG
0 Replies
2010 Views
Last post December 11, 2019, 07:01:19 AM
by olutee
0 Replies
282 Views
Last post January 06, 2022, 07:15:57 AM
by The Guardian
0 Replies
133 Views
Last post November 01, 2022, 07:19:13 AM
by PulseNG
0 Replies
117 Views
Last post April 22, 2023, 01:01:25 PM
by olutee