NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page GEO-IP with PHP

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-30-2007, 04:54 AM THREAD STARTER               #1 (permalink)
NamePros Member
 
darmar's Avatar
Join Date: Dec 2006
Location: Zagreb, Croatia
Posts: 103
darmar is an unknown quantity at this point
 



Question GEO-IP with PHP


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
darmar is offline  
Old 07-30-2007, 05:18 AM   #2 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
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 Code:
ip $_SERVER['REMOTE_ADDR'];
????: NamePros.com http://www.namepros.com/programming/355748-geo-ip-with-php.html
$locale = @file("http://api.hostip.info/country.php?ip=".$ip); 
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 07-30-2007, 05:20 AM   #3 (permalink)
NamePros Member
 
guillermobt's Avatar
Join Date: Sep 2005
Posts: 160
guillermobt is on a distinguished road
 



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.
guillermobt is offline  
Old 07-30-2007, 05:21 AM   #4 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,069
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Originally Posted by guillermobt
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).
????: NamePros.com http://www.namepros.com/showthread.php?t=355748

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.
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 07-30-2007, 07:16 AM   #5 (permalink)
Danltn.com
 
Daniel's Avatar
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
Daniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond reputeDaniel has a reputation beyond repute
 


Ethan Allen Fund Ethan Allen Fund
I messed around with it for a bit and created http://mf1.us/ip - Their database isn't really big enough yet though.
Daniel is offline  
Old 07-30-2007, 08:46 AM THREAD STARTER               #6 (permalink)
NamePros Member
 
darmar's Avatar
Join Date: Dec 2006
Location: Zagreb, Croatia
Posts: 103
darmar is an unknown quantity at this point
 



Yup, that's it, I forgot about it.... I'm screeming to myself now - RTFM !!!!

Thanks !
darmar is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:36 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger