NameSilo

GEO-IP with PHP

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

darmar

Established Member
Impact
0
Hi


I need a little help.

I'm using
http://api.hostip.info/country.php
to fetch the locale of the visitor.

I'd like to fetch this through my PHP script, with something like this:
$locale = @file("http://api.hostip.info/country.php");

But, then this web service doesn't fetch my visitors location, but my web server location.

I need tihs to programatically set the default language for my multilanguage website.

Does anybody have any idea how to "fix" this ?


Thank you
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
just had a quick look on their site and it just seems a simple case of you not putting the ip variable on the address you should have:-

PHP:
ip = $_SERVER['REMOTE_ADDR'];
$locale = @file("http://api.hostip.info/country.php?ip=".$ip);
 
0
Close
You should look for another solution, because this one will always show the GEOinfo of the host calling the script (i.e.: your own IP).

I have a geoinfo script running here:

http://fadlan.com/ip

and this one lets you enter the desired IP:

http://fadlan.com/ip2c


Regards.
 
0
Close
guillermobt said:
You should look for another solution, because this one will always show the GEOinfo of the host calling the script (i.e.: your own IP).

I have a geoinfo script running here:

http://fadlan.com/ip

and this one lets you enter the desired IP:

http://fadlan.com/ip2c


Regards.

Ther service he is using allows you to specify the IP it is just a case for some reason he has not.
 
0
Close
I messed around with it for a bit and created http://mf1.us/ip - Their database isn't really big enough yet though.
 
0
Close
Yup, that's it, I forgot about it.... I'm screeming to myself now - RTFM !!!! :)

Thanks !
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back