Thursday, 30 January 2014

IP track location city


<?php
   $key='4aa3d8dd845debd79b15b3d55449dbeddbf00645e0acdd2b943a99f298b9c089';
   /*include('ip2locationlite.class.php');
   $ipLite = new ip2location_lite;
   $ipLite->setKey('4aa3d8dd845debd79b15b3d55449dbeddbf00645e0acdd2b943a99f298b9c089');
 
   echo "<br>RA : ".$_SERVER['REMOTE_ADDR'];
 
   $tags = $ipLite->getCity($_SERVER['REMOTE_ADDR']);
   $errors = $ipLite->getError();
 
   echo "<pre>"; print_r($errors); echo "</pre>";*/
 
   //http://api.ipinfodb.com/v3/ip-country/?key=4aa3d8dd845debd79b15b3d55449dbeddbf00645e0acdd2b943a99f298b9c089&ip=122.163.43.151
 
   echo "<br>U : ".$url='http://api.ipinfodb.com/v3/ip-country/?key='.$key.'&ip='.$_SERVER['REMOTE_ADDR'];
   $ch = curl_init($url);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   $data = curl_exec($ch);
   curl_close($ch);
 
   $dataArr=explode(";",$data);
 
   echo "<pre>"; print_r($dataArr); echo "</pre>";
?>


Link:- http://www.ipinfodb.com/ip_location_api.php

No comments:

Post a Comment