Forwarding to a web page based on ip address

Hi all

I have tasked with finding out the following

We are a sales company and also act as a reseller for other companys, what that would like to is if someone is buying a product from one of our resellers website what would happen at the moment is they would click on what they want to buy and then go to a third party shopping cart site, what I would like to know is, is it possible if anyone wants to buy a product and that user is based in the uk can the website detect this and if so could they then be redirected. To another site with different prices, if they are not in the uk it would just work as normal.

I must add I know nothing about the website that I am talking about ie: what it's written in etc, I just would like to know if it's possible and what steps I would need to advise on to achieve this.

Thanks

John
pepps11976Asked:
Who is Participating?
 
jan-janssenConnect With a Mentor Commented:
A friend of mine wrote a script for this http://shockmarketer.com/geoip-country-location-php-script/ the script http://shockmarketer.com/country-redirect/country-redirect.php.zip simply gives you the country code then you can simply modify the code country-redirect.php in 503, simply replace
echo $country;

Open in new window

with
if($country == 'UK')
{
header('Location: http://example.co.uk');
exit();
}
else if($country == 'US')
{
header('Location: http://example.com');
exit();
}

Open in new window


For the script to work it also required the IP Map to be placed in the same directory
http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
0
 
ganixCommented:
You can detect country and language with javascript. Here are two links that could be usefull for you to check:
http://javascript.about.com/library/bllang.htm
http://www.javascriptkit.com/jsref/navigator.shtml
0
 
ErezMorCommented:
as i only work with asp.net, i often use Page.Request.UserHostAddress() to get the ip address of the user calling the page.
having that at hand, there are many web-sites/web services that given an ip adddress will tell you not only from which country the request originated, but from which town/region
0
 
pepps11976Author Commented:
Thanks for the info so if I used one of the above methods to check the origin of the user how do you code to say if from united kingdom then go to different site?

John
0
 
ganixConnect With a Mentor Commented:
I've remember I saved some bookmarks with this kind of request. Here you have the entire code in php from Harald Hope under GNU public license:
http://techpatterns.com/downloads/scripts/php_language_detection.txt

Hope this was helpfull.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.