Question:

Auto Detect IP address script and point to a different link

by  |  earlier

0 LIKES UnLike

HI, I am looking for a script that will detect a visitors ip address and point them another link. For example i want my canadian visitors to be brought to ca.link.com and I want my German visitors to be brought to de.link.com does anyone know a script I can install on my site that will do this? Thanks a lot.

 Tags:

   Report

2 ANSWERS


  1. You'll need to obtain the users IP address...easy to do:

    If you're using PHP, for example:

    $IP = $HTTP_SERVER_VARS ["HTTP_X_FORWARDED_FOR"];

    $proxy = $HTTP_SERVER_VARS ["REMOTE_ADDR"];

    $host = @gethostbyaddr($HTTP_SERVER_VARS ["HTTP_X_FORWARDED_FOR"]);

    You'll get something that will look like this...

    313.88.1.99 <--IP addy of user.

    62.31.224.1 <--IP addy of server.

    313-88-1-99.bas.cvx.blueyonder.co.uk <-- Users host addy.

    Then you'll need to check their IP address against a database of IP's by country...you can download a pretty good one from

    http://ip-to-country.webhosting.info/boo...

    But anything better than this, you'll have to pay for.


  2. http://www.12scripts.com/scripts.php?scr...

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.