Accessing location data with IP

You can simply use the codes below to find a location through ip-api.com. You can visit ip-api.com site for detailed information about this tool that you can use as an api.


<?php
$ip = $_SERVER['REMOTE_ADDR'];
echo $ip = file_get_contents("http://ip-api.com/xml/".$ip);
echo $cek = new SimpleXMLElement($ip);
echo $lg = $cek->countryCode;
?>

0 Yorum

Soru & Yorum


Web Tasarım

Renkli Kare

Web Tasarım Ajansı