Advertisement
mr-taha

ip user countary

Aug 2nd, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. <?php
  2. // فونكشن اظهار ايبي دولة عضو
  3. function ipToCountry($ip){
  4.  
  5.     $info = file_get_contents("http://who.is/whois-ip/ip-address/$ip");
  6.  
  7.     list($a, $b) = explode('country:        ', $info);
  8.  
  9.     return  substr($b,0,2);
  10.  
  11. }
  12.  
  13. echo "Your IP: ".$_SERVER['REMOTE_ADDR']."";
  14.  
  15. echo 'Country: ' .ipToCountry($_SERVER['REMOTE_ADDR']);
  16.  
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement