How do I know the country of a particular IP?

Asked

Viewed 191 times

0

Well what I intended was to know what was the country of a certain IP, I already used PHP geoiplocation, however when I start running on my server appears to me the following error:

Fatal error: Call to undefined function geoip_country_name_by_name() in C:\Program Files\VertrigoServ\www\ExtraGrana\new\testando.php on line 4

When I put it on my Cpanel server, the following message appears: The "my site url" page is not working."

<?php


$country = geoip_country_name_by_name('www.google.com');


echo $country;
?>

What’s wrong with this code?

Thank you.

1 answer

3

  • Is installing this on Linux hard to do? There is no easier alternative?

  • yum install php-Pear

  • You can try to get the IP with JS. But if you want with PHP I know no other way.

  • The IP I know pick, I wanted was the name of the country of that particular IP.

  • So. If you use PECL you can get the name using geoip_country_name_by_name

Browser other questions tagged

You are not signed in. Login or sign up in order to post.