How To Create Ip to Location Tracker Tool with Php



How to Get IP Address of User in PHP

how to get ip address in php w3schools


Hello friends welcome here,today i will tell you how to create a tool which helps wee can track any ip address location information like log,lon,address,pincode,internet service provider,country ,state etc details.
you  just have  to copy the following code and paste it in your website.

How to get system ip address in php
Code-user ip address php code

<form action="" method="POST">


<h2> Track Ip Address Location  </h2>




<input type="text" name="ip"/>



<br>



<input type="submit" name="submit" value="Track ip">















</form></fieldset>





























<?php











if(isset($_POST['submit'])){



$ip = $_POST['ip']; // the IP address to query



$query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip));



if($query && $query['status'] == 'success') {

?>



<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
  border: 1px solid black;
}
</style>
</head>
<body>



<table>
  <tr>
    <th></th>
    <th><?php

  echo 'visitor from '.$query['country'].', '.$query['region'].'!';

?></th>
  </tr>
  <tr>
    <td>City</td>
    <td><?php

  echo  $query['city'];

?>


</td>
  </tr>
  <tr>
    <td>Zip Code</td>
    <td><?php

  echo  $query['zip'];

?></td>
  </tr>
   <tr>
    <td>Lois</td>
    <td><?php

  echo  $query['zip'];

?></td>
  </tr>
   <tr>
    <td>Timezone</td>
    <td><?php

  echo $query['timezone'];

?>
</td>
  </tr>
   <tr>
    <td>ISP</td>
    <td><?php

  echo  $query['isp'];

?>
</td>
  </tr>
  <tr>
    <td>IP</td>
    <td><?php

  echo $query['query'];

?>
</td>
  </tr>
  <tr>
    <td>Lat</td>
    <td><?php

echo $query['lat'];

?>
</td>
  </tr>



   <tr>
    <td>Lon</td>
    <td><?php

echo $query['lon'];

?>
</td>
  </tr>
</table>

</body>
</html>











<?php

} else {



  echo 'Unable to get location';



}



}



?>





<br>




</center>

(how to get ipv4 address in php

get user ip address php)

Previous
Next Post »
Thanks for your comment