[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 07-30-2007, 03:54 AM   #1 (permalink)
NamePros Member
 
darmar's Avatar
 
Join Date: Dec 2006
Location: Zagreb, Croatia
Posts: 98
0.00 NP$ (Donate)

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
__________________
Martic.net - Talking in binary since 1980.
TXTberry.com - Text-based services for blackberry and other mobile devices (whois, etc.).
darmar is offline  
Old 07-30-2007, 04:18 AM   #2 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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'];
$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, 04:20 AM   #3 (permalink)
NamePros Member
 
Join Date: Sep 2005
Posts: 147
420.00 NP$ (Donate)

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.
__________________
technfo.com - pick.pk - ajaxpro.es - gbt.es - jamones.cn - sqzd.com - geoinfo.net

Free URL Redirection (for sale) (62,000+ subdomains and growing!!) Real IP / Proxy IP
guillermobt is offline  
Old 07-30-2007, 04:21 AM   #4 (permalink)
Senior Member
 
Peter's Avatar
 
Join Date: Nov 2003
Location: Scotland
Posts: 4,900
0.60 NP$ (Donate)

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
Quote:
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).

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, 06:16 AM   #5 (permalink)
Danltn.com
 
Daniel's Avatar
 
Join Date: May 2007
Location: Danltn.com / Nottingham, UK
Posts: 1,201
13.51 NP$ (Donate)

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, 07:46 AM   #6 (permalink)
NamePros Member
 
darmar's Avatar
 
Join Date: Dec 2006
Location: Zagreb, Croatia
Posts: 98
0.00 NP$ (Donate)

darmar is an unknown quantity at this point


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

Thanks !
__________________
Martic.net - Talking in binary since 1980.
TXTberry.com - Text-based services for blackberry and other mobile devices (whois, etc.).
darmar is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 04:04 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85