Geo-IP onClick redirect
2016-03-14, 03:50 AM,
#1
Hello, I try for the last hours to get a onClick geo-ip redirect that I can use for my wordpress site. Basically when a US person click the "Download" he should go to English LP, when a FR clicks, to FR LP and so on. All scripts that I find redirect on page load, I want on click.

Here is what I found but can't make it work.

PHP Code:
<?php
$country_code 
$_SERVER["HTTP_CF_IPCOUNTRY"];
if (
$country_code=="UK") {
$link 'Insert UK Link';
}
elseif (
$country_code=="FR") {
$link 'Insert France Link';
}
elseif (
$country_code=="DE") {
$link 'Insert Germany Link';
}
else {
$link 'Insert Default Link';
}
header("location:$link");
exit;
?>

Basically I want the <a href = "http://mylanding.com" /a> to change according to country.
Reply
Share This Thread :
2016-03-14, 03:59 AM,
#2
Latest Thanks - View all

ςσsmiη(2016-03-14 02:51 PM) 
Reply
2016-03-14, 10:34 AM,
#3
Link Cloaker WordPress plugin does this for you.

Boost Your Instagram Likes: Boosted Likes
Reply
2016-05-04, 01:14 AM,
#4
It worked ?

/20 charact
Reply
2016-05-05, 08:30 AM,
#5
obviously its not going to work lol how would it know which country the user is coming from?
need to use an API to get the country
you can use old maxmind geoip database if you google for it
Latest Thanks - View all

ςσsmiη(2016-05-05 02:40 PM) 
Reply
2016-05-05, 02:40 PM,
#6
(2016-05-04, 01:14 AM)Wolfz Wrote: It worked ?

/20 charact

Nope, answer is below:

(2016-05-05, 08:30 AM)lancerimpact Wrote: obviously its not going to work lol how would it know which country the user is coming from?
need to use an API to get the country
you can use old maxmind geoip database if you google for it
Reply
2016-05-05, 08:01 PM,
#7
Let's assume that HTTP_CF_IPCOUNTRY (it seems it's CloudFlare only param) returns you a country code.

PHP Code:
$countryCode $_SERVER["HTTP_CF_IPCOUNTRY"];

$link 'http://example.link';
switch (
$countryCode) {
    case 
'UK':
        
$link 'http://example.link/uk';
        break;
    case 
'FR':
        
$link 'http://example.link/fr';
        break;
    case 
'DE':
        
$link 'http://example.link/de';
        break;
}

/* You do this if let's say you have  a link in your html which says Download and it points to this script and when user clicks it he will be redirected to localized download page*/
header("location:" $link);
exit;

/* or you echo it in your html if you want user to only see the localized link without any redirects */
echo '<a href="'.$link.'">Download</a>'
Latest Thanks - View all

ςσsmiη(2016-05-06 03:02 PM) 
Reply
2016-05-10, 04:01 AM,
#8
"You do this if let's say you have a link in your html which says Download and it points to this script and when user clicks it he will be redirected to localized download page."

Exactly my case.
Reply
2016-05-10, 06:09 PM,
#9
or you can try this link shortener for country redirect. they also have mobile redirect too.
https://manage.smarturl.it/
Latest Thanks - View all

ςσsmiη(2016-05-28 09:57 PM) Khaleesi(2016-05-10 06:45 PM) 
Reply


Related Threads
Thread Author Replies Views Last Post
  Can you complete survey with RESIDENTAL PROXY IP's? HackerCzExtreme 1 120 2018-02-15, 02:28 AM
Last Post: HawkEye
  Youtube Accounts Per Ip? How much is safe? f1rew1re 6 259 2018-02-08, 11:38 PM
Last Post: shahanavaasu
  Redirect user based on certain ISP Mix2003_2012 4 185 2017-11-28, 11:41 PM
Last Post: styx
  Affiliate Network With More Geo's for Weight Loss Niche Ghettoweed 5 294 2017-11-17, 08:18 PM
Last Post: Ana_AdCombo
  (help) Redirect Blogspot engkusplus 3 229 2017-11-04, 08:01 AM
Last Post: engkusplus





About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2018 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top