[TUTORIAL] Simple Geo Redirect Script
2017-06-11, 03:59 PM,
#1
Hello Elites,

I wrote a comment in another thread about geo redirection and I saw some of you are confused about it. So I decided to share a really simple and of course free php script, to redirect your visitors to the correct CPA offer based on their country. You know, if you promote an offer where only USA visitors are allowed, then your visitors from other countries are redirected somewhere else, to a different offer, which often not related to your main offer. So best option is to pick you your offers for all the targeted countries and redirect them by yourself! Some networks has a builtin tool to do this, but sometimes there isn't.

Of course no one wan't to pay for such a simple thing, which can be made in 5 minutes. But I know, most of you don't have programming knowledge, so I share this script with you.

Let's get started:

[hide]
Log in to your FTP client and locate the folder where you want to place your redirect script. Make a new file with .php extension, let's name it redirect.php

Place the following code inside:

PHP Code:
<?php
$a 
unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$_SERVER['REMOTE_ADDR']));
$countrycode$a['geoplugin_countryCode'];

if (
$countrycode=='US')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=9378&tracking_id=' ) ;
else if (
$countrycode=='GB')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=9643&tracking_id=' ) ;
else if (
$countrycode=='CA')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=5882&tracking_id=' ) ;
else if (
$countrycode=='FR')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=9970&tracking_id=' ) ;
else if (
$countrycode=='AU')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=5872&tracking_id=' ) ;
else if (
$countrycode=='IE')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=10791&tracking_id=' ) ;
else if (
$contrycode=='TR')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=9654&tracking_id=' ) ; 
else if (
$countrycode=='IN')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=10815&tracking_id=' ) ; 
else
    
header'Location: http://google.com' ) ;
?>

The URLs in the code are just examples!!! CHANGE it to your own offer URLs.

You can see, the code is really simple. The $countrycode variable contains the code of visitors country. So you can just check it, wheter it matches with some countries, or not.

The last "else" contains the case, if none of the above countries matches you visitors country. Then your visitor will be redirected to here. This is a default case URL, so if you pick offers for 10 countries, then all of the visitors from the remained countries will be redirected here.

You can easily add new countries, just add a new "else if", above the last "else".
For example:

PHP Code:
else if ($countrycode=='IN')
    
header'Location: https://www.cpagrip.com/show.php?l=0&u=97145&id=10815&tracking_id=' ) ; 
else if(
$countrycode=='HU')
    
header'Location: http://google.hu' ) ; 
else
    
header'Location: http://google.com' ) ; 

The country codes can be found here: http://www.geoplugin.com/iso3166

[/hide]
Reply
Share This Thread :

2017-06-11, 04:32 PM,
#2
Thanks bro! Giving you +rep :D
Reply
2017-06-11, 11:42 PM,
#3
thanks very much for this code
Reply
2017-06-11, 11:54 PM,
#4
Great mate! Thanks I'll find use for this for sure :) Cool

↘ Best CPA Network for Desktop/Mobile Traffic! ↙
[Image: s1R2zy]
BH +FR PINS, 1000s of TEMPLATES, 5k OFFERS+, $5 SIGN UP BONUS, BITCOIN PAYOUT, Weekly Payouts (Default)
Reply
2017-06-12, 01:03 AM,
#5
Great share Bro. Geo IP targeting is a great method. to convert and rotate offers. according to IP.
And u shared with a full description that how to do it.
Thanks, BRO.
Reply
2017-06-13, 03:25 AM,
#6
thanks, great script, appreciate your work
Reply
2017-06-15, 07:47 AM,
#7
I DON'T UNDERSTAND, MORE EXPLANATION PLEASE.
Reply
2017-06-15, 11:01 AM,
#8
Thank you! Great share!!
Reply
2017-06-15, 12:57 PM,
#9
Woah, I'm looking for this code everywhere and finally found it here. You're truly awesome, Wyctus :)
Reply
2017-06-15, 05:31 PM,
#10
(2017-06-15, 07:47 AM)walterzingo Wrote: I DON'T UNDERSTAND, MORE EXPLANATION PLEASE.

Which part isn't clear?
Reply


Related Threads
Thread Author Replies Views Last Post
  [FREE] Cloak Script Watt 76 8,592 2018-07-19, 08:52 AM
Last Post: hutiya
  [HQ Tutorial]»» Boost your conversions/CTR - add a countdown to your landing page «« allnet 68 10,973 2018-07-18, 07:58 PM
Last Post: YoBroGo
  [GET] HQ PHP Script - Watch Movies Online - GROF 63 20,925 2018-07-17, 04:41 PM
Last Post: ℛage
  [Tutorial] How to make unlimited YouTube accounts if you have static IP Andrei 58 7,002 2018-07-16, 07:50 PM
Last Post: ferb67
  RIP Unlist Method - Alternative Methods (Tutorial) :) alexparris 70 9,208 2018-07-13, 01:23 PM
Last Post: Tyrone





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

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