DNforum.com - Domain Sales, Domain Forum, Domain Appraisals
 
Register Now! Welcome to Dnforum.com You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast and simple so please, join our community today! If you have any problems with the registration process or your account login, please contact us.
Go Back   DNForum - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars > Content Development > Website Development and Design Discussion > Coding/Programming/Languages
Reply
 
LinkBack Thread Tools Display Modes
Old 07-30-2007, 06:55 AM   #1 (permalink)
Platinum Lifetime Member
 
darmar's Avatar
 
Name: Darko Martic
Last Online: 06-30-2008 10:09 AM
iTrader: (1)
Join Date: Dec 2006
Posts: 89
DNF$: 100
Location: Zagreb, Croatia
Country:


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
__________________
www.Martic.net | www.AntiWrap.com
darmar is offline   Reply With Quote
Old 07-30-2007, 10:00 AM   #2 (permalink)
Platinum Lifetime Member
 
Last Online: 07-07-2008 11:50 PM
iTrader: (1)
Join Date: Oct 2003
Posts: 243
DNF$: 593
Location: michigan


Re: GEO-IP with PHP

http://www.hostip.info/use.html

Quote:
Simple GET
That said, there is an easy HTTP oriented API to locate IP addresses and Geocode them. If you don't supply the "?ip=aa.bb.cc.dd" bit, then the ip address lookup of the calling machine will be located instead (here, the aa,bb,cc,dd are decimal digits). If you add &position=true to the end of the URL then latitude and longitude will be returned also. Both HTML and XML formats are supplied for your convenience.
In short, you need to include in the get the IP address of the user hitting your site in a URL passed variable like:

Code:
$ip = $_SERVER['REMOTE_ADDR'];
$url = 'http://api.hostip.info/get_html.php?ip=$ip';
harleyx is offline   Reply With Quote
Old 07-30-2007, 10:46 AM   #3 (permalink)
Platinum Lifetime Member
 
darmar's Avatar
 
Name: Darko Martic
Last Online: 06-30-2008 10:09 AM
iTrader: (1)
Join Date: Dec 2006
Posts: 89
DNF$: 100
Location: Zagreb, Croatia
Country:


Re: GEO-IP with PHP

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

Thanks !
__________________
www.Martic.net | www.AntiWrap.com
darmar is offline   Reply With Quote
Reply



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

Posting Rules

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
F$ for Membership Upgrade with Bonus wendy DNF$ Sales/Domain Auctions 35 05-12-2007 12:39 AM
14 Super PHP scripts, Ringtone site, and Photorating website! NavySeals91 DNF$ Sales/Domain Auctions 21 07-06-2006 08:09 PM
a nice one: mysqlphp.com Domain Name Appraisal Discussion 2 04-27-2002 05:29 PM


All times are GMT -4. The time now is 01:30 AM.
Copyright @2001-2008 DNForum.com

Learn Domains
Promote Domains
Research Domains
Buy Domains
Resell Domains
Park Domains
Sell Domains
Build Domains
Host Domains
Trademark Domains
Domain Domains
manage Domains
Appraise Domains