[HQ] [PHP SCRIPT] FOR COUNTRY REDIRECT
2016-09-15, 03:23 PM, (This post was last modified: 2016-09-15, 04:33 PM by trafficbeast.)
#1
Many guys asked me so i coded it with love Surprised


CODE:
[hide]
PHP Code:
<?php
ob_start
();

//get IP
    
$client  = @$_SERVER['HTTP_CLIENT_IP'];
    
$forward = @$_SERVER['HTTP_X_FORWARDED_FOR'];
    
$remote  $_SERVER['REMOTE_ADDR'];

    if(
filter_var($clientFILTER_VALIDATE_IP))
    {
        
$ip $client;
    }
    elseif(
filter_var($forwardFILTER_VALIDATE_IP))
    {
        
$ip $forward;
    }
    else
    {
        
$ip $remote;
    }


 
$api_key 'PUTYOURAPIKEYHERE'//please put API

$data file_get_contents("http://api.ipinfodb.com/v3/ip-city/?key=$api_key&ip=$ip&format=json");
$data = (array) json_decode($data);
$c $data['countryCode'];

 
// ES is country code for spain
if($c=="ES"
{
//do actions on this country
header("Location: http://urlofthisEScountry.com");
}
else if(
$c=="FR")
{
header("Location: http://urlofthisFRcountry.com");
}
else if(
$c=="IT")
{
header("Location: http://urlofthisITALYcountry.com");
}

//put soo on!

?>

[/hide]

1. how to get API

register here: http://ipinfodb.com/register.php
WAIT!! see step 2

2. how to get your server/shared hosting IP
this IP you need to put as server IP while registering account on above url

use this php code:
PHP Code:
<?php
echo file_get_contents("http://ipecho.net/plain");
?>

run above code on your server to know ur server IP

3. put API key inside your php file in $api_key = '';

4. define your rules for country redirect


here are list of all country and their country codes
https://countrycode.org/
http://www.nationsonline.org/oneworld/co...e_list.htm

example: ES for spain, FR for france.

put if($c=="ES") for spain redirect rule and soo on!


remove non needy code like this:
example if u want spain only..


if($c=="ES")
{
header("Location: http://urlofthisEScountry.com");
}

i cant explain more but u need some knowledge of php..

thanks!


I RECOMMEND YOU USING CPAELITES CODE:

http://www.cpaelites.com/tools/

TESTED METHOD TO EARN MONEY WITH PPV - AUTOPILOT- ONLY FOR CPAELITES

ABOVE METHOD in signature, has WORKED FOR ME AND MY FRIENDS. Cool ENJOY FOR VIP ONLY
Reply
Share This Thread :

2016-09-15, 05:14 PM, (This post was last modified: 2016-09-15, 05:15 PM by SuperSimple.)
#2
There's a much simpler version, no API needed.

Here you go:

Just create new php file "redirect.php" and copy paste this script to it. And don't forget to change your links.

Code:
<?php


$call = unserialize(file_get_contents('http://ip-api.com/php/'.$_SERVER['REMOTE_ADDR']));
$country = $call["countryCode"];




if ($country == "US") {
  header("Location: url=http://example.com/us.php");
}
elseif ($country == "CA") {
  header("Location: http://example.com/ca.php");
}
elseif ($country == "MX") {
  header("Location: http://example.com/mx.php");
}
elseif ($country == "ID") {
  header("Location: http://example.com/id.php");
}
elseif ($country == "PH") {
  header("Location: http://example.com/ph.php");
}

else {
  header("Location: http://example.com/other.php");
}


exit();
?>
<!DOCTYPE html>
<html lang="en"><head>



<meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="robots" content="noindex, nofollow">
  
</head>
<body>


    
<center>
<h3>You are being Redirected</h3>



</center>
</body>
</html>

I'm a Web Developer. Contact me for bigger projects only.
Reply
2016-09-15, 05:25 PM,
#3
(2016-09-15, 05:14 PM)SuperSimple Wrote: There's a much simpler version, no API needed.

Here you go:

Just create new php file "redirect.php" and copy paste this script to it. And don't forget to change your links.

Code:
<?php


$call = unserialize(file_get_contents('/php/'.$_SERVER['REMOTE_ADDR']));
$country = $call["countryCode"];




if ($country == "US") {
  header("Location: url=/us.php");
}
elseif ($country == "CA") {
  header("Location: /ca.php");
}
elseif ($country == "MX") {
  header("Location: /mx.php");
}
elseif ($country == "ID") {
  header("Location: /id.php");
}
elseif ($country == "PH") {
  header("Location: /ph.php");
}

else {
  header("Location: /other.php");
}


exit();
?>
<!DOCTYPE html>
<html lang="en"><head>



<meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="robots" content="noindex, nofollow">
  
</head>
<body>


    
<center>
<h3>You are being Redirected</h3>



</center>
</body>
</html>



this and many other script not worked .. when traffic was TOO high they suspend ur server IP Smile

TESTED METHOD TO EARN MONEY WITH PPV - AUTOPILOT- ONLY FOR CPAELITES

ABOVE METHOD in signature, has WORKED FOR ME AND MY FRIENDS. Cool ENJOY FOR VIP ONLY
Reply
2016-09-15, 06:31 PM,
#4
(2016-09-15, 05:25 PM)trafficbeast Wrote: this and many other script not worked .. when traffic was TOO high they suspend ur server IP Smile

Yeah, they have limits of something like 100/minute, but the free API you've provided have almost the same limits. If traffic volume is high it's better to setup your own checker or to buy an API with bigger/unlimited limits.

I'm a Web Developer. Contact me for bigger projects only.
Reply
2016-09-15, 06:32 PM, (This post was last modified: 2016-09-15, 06:32 PM by trafficbeast.)
#5
(2016-09-15, 06:31 PM)SuperSimple Wrote:
(2016-09-15, 05:25 PM)trafficbeast Wrote: this and many other script not worked .. when traffic was TOO high they suspend ur server IP Smile

Yeah, they have limits of something like 100/minute, but the free API you've provided have almost the same limits. If traffic volume is high it's better to setup your own checker or to buy an API with bigger/unlimited limits.

yaa haa haa.. its ok i can code my own when i got time

(2016-09-15, 06:31 PM)SuperSimple Wrote:
(2016-09-15, 05:25 PM)trafficbeast Wrote: this and many other script not worked .. when traffic was TOO high they suspend ur server IP Smile

Yeah, they have limits of something like 100/minute, but the free API you've provided have almost the same limits. If traffic volume is high it's better to setup your own checker or to buy an API with bigger/unlimited limits.

how ever i have cpvlabs latest Null3D too!

so its good for this

TESTED METHOD TO EARN MONEY WITH PPV - AUTOPILOT- ONLY FOR CPAELITES

ABOVE METHOD in signature, has WORKED FOR ME AND MY FRIENDS. Cool ENJOY FOR VIP ONLY
Reply
2016-09-15, 06:54 PM,
#6
(2016-09-15, 06:32 PM)trafficbeast Wrote: how ever i have cpvlabs latest Null3D too!

so its good for this

Good for you. Maybe you could share it with us? ;)

I'm a Web Developer. Contact me for bigger projects only.
Reply
2016-09-16, 04:13 AM,
#7
Money Cashers has shared something like this too and I would recommend you guys using that, I've used it in past and it worked very well
BTW thanks for the share OP
Reply


Related Threads
Thread Author Replies Views Last Post
  [HQ] GET GSA Software Training with Jimmy Kelley- worth $497- [Rated #1 GSA Training] kungfu.824 36 8,359 2 hours ago
Last Post: Janaka
  [GET][HQ][TUT] Movie Locker Template ( Java, Search, Multiple-niche ) + Setup TuT ⭐️ Borislav ⭐️ 55 22,491 2018-07-15, 02:31 PM
Last Post: amandh
  [HQ Tutorial]»» Boost your conversions/CTR - add a countdown to your landing page «« allnet 67 10,857 2018-07-14, 06:22 PM
Last Post: king007
  [HQ](Boost Conversion) How to prevent Chrome from blocking your PPI installers DeathGun 60 8,282 2018-07-12, 11:26 AM
Last Post: offer494
  How To Find Top Country Targetted Trending Niches Very Easily! [HOT] [Un-saturated] Aɪʀʙᴏʀɴᴇ ⭐️ 71 12,689 2018-07-10, 02:22 AM
Last Post: beconnected16





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

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