Jump to content

Recommended Posts

Posted

Ho thanks a lot sorry :)/&--#62;

But in the code there is : require_once "Net/GeoIP.php";

I don't have this file, I can't find it, if I delete this line, it sais : Fatal error: Class 'Net_GeoIP' not found in /home1/thio175/public_html/test.php on line 4

$geoip = Net_GeoIP::getInstance("/path/to/geoipdb.dat");

Ftp manager can't find the file too in ftp.

 

Posted

Hi, I need to have the country of the IP !

Because In minecraft my plugin have to get the country from my url !

But in the code there is :require_once "Net/GeoIP.php"

 

I don't have this file, I can't find it,

Ok, I tested this out for you. Here is my test site: http://krydos.tk/country/

 

To create this site I first went to http://stevie.heliohost.org:2082/frontend/x3/module_installers/index.html?lang=php-pear to install the Net_GeoIP package. Once it is installed you will be able to find the files at /home1/thio175/php/Net/ I then copied them to the public_html/country folder to simplify my code, but I'm sure they would work fine where they were.

 

Then I created my index.php file with the following contents:

<?php
require_once "Net/GeoIP.php";

$geoip = Net_GeoIP::getInstance("GeoIP.dat");

echo $geoip->lookupCountryName($_SERVER['REMOTE_ADDR']);

 

The GeoIP.dat file I got for free from maxmind's website which is linked from the documentation of Net_GeoIP, but you can download it from my website if it's easier for you. http://krydos.tk/country/GeoIP.dat and just put that file somewhere on your account where your php script can access it.

  • Like 1
Guest
This topic is now closed to further replies.
×
×
  • Create New...