Important: Valar Solutions scam - Have you been also scammed by Valar Solutions? - Please click [here] to read more! - Valar Solutions fraud
Snapchat Contest #1 Free Snapchat bot access for you! Please click [here] to read more! (Last update: 8th of January 2020)
January 2020 news -  CPAElites Essentials (2020) is coming: Please click [here] to read more!


[TUTORIAL] Simple Geo Redirect Script
2017-06-11, 12:29 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
2017-06-11, 01:02 PM,
#2
Thanks bro! Giving you +rep :D
Reply
2017-06-11, 08:12 PM,
#3
thanks very much for this code
Reply
2017-06-11, 08:24 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-11, 09:33 PM,
#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-12, 11:55 PM,
#6
thanks, great script, appreciate your work
Reply
2017-06-15, 04:17 AM,
#7
I DON'T UNDERSTAND, MORE EXPLANATION PLEASE.
Reply
2017-06-15, 07:31 AM,
#8
Thank you! Great share!!
Reply
2017-06-15, 09:27 AM,
#9
Woah, I'm looking for this code everywhere and finally found it here. You're truly awesome, @Wyctus :)
Reply
2017-06-15, 02:01 PM,
#10
(2017-06-15, 04:17 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/SCRIPT] PHP Geo/Country Redirect - Powerful Script! Restricted7 20 6,341 2020-01-13, 06:26 AM
Last Post: efendingk
  Geo-Redirect Script [Target Countries on any url] Jaxxon 16 3,922 2020-01-09, 01:41 PM
Last Post: galax
  [FREE] Cloak Script Watt 117 18,755 2019-12-09, 08:43 AM
Last Post: almichaelz
  PHP Script to Block Bad Traffic - Proxy/Bot/VPN/TOR TikadoKan 15 5,535 2019-11-29, 09:45 AM
Last Post: asmare01
  moro1991>>1# share... HQ dating landing page.Simple to customize !!! moro1991 16 4,309 2019-11-20, 04:39 AM
Last Post: Microlux7





About Us | Contact Us | CPAElites | Advertise | Stats

Copyright © 2013 - 2019 by (company to be announced later)
Temporarily (!) powered by MyBB, fixed (repaired) and enhanced by Charlie Harper (GitHub) aka Charles Francis Harper (Wikipedia)
Return to top
This forum uses Lukasz Tkacz MyBB addons.