Help with GeoRedirection script

by 9 replies
11
If someone can please help me with this and tell me why it's not working I would really appreciate it. This is on my tracking server to hand off to Prosper for tracking traffic and routing to different CPA offers. Traffic coming from Facebook for testing.

PHP Code:
<?php

$CountryCode 
geoip_record_by_name$_SERVER["REMOTE_ADDR"] );

// ****DO NOT TOUCH ABOVE THIS LINE.******
// link destination for creatives *****track.info/track/ayiau/index.php?

$t202id $_GET['id'];
$t202kw $_GET['kw'];
$country $_GET['c1'];
$c2 $_GET['c2'];
$c3 $_GET['c3'];
$c4 $_GET['c4'];

if(
$CountryCode=="AU")
{
header('Location:   http://*****ftrack.info/tracking202/redirect/dl.php?t202id=3227'.$t202id.'&t202kw='.$t202kw.'&c1='.$country.);  
}
else if(
$CountryCode=="US")
{
header('Location:  http://******ftrack.info/tracking202/redirect/dl.php?t202id=7214'.$t202id.'&t202kw='.$t202kw.'&c1='.$country.);
}
else if(
$CountryCode=="UA")
{
header('Location: http://foto.ua');
}
//Change this to reflect your international offers for country codes not listed above. This is for the US offer
else
{
header('Location:   http://******track.info/tracking202/redirect/dl.php?t202id=7214'.$t202id.'&t202kw='.$t202kw.'&c1='.$country.);
}
?>
Thank you for any help.
#programming #cpa #georedirection #php #prosper #script
  • Also forgot to metion GeoIP lookup is done with Maxmind installed globally on my VPS.
  • Have you made sure that the geoip module for PHP is loaded?
  • Yes I have a test page and it identies the IP and the country code correctly.
  • So where's the problem in the script above. Can you echo out $CountryCode and get a value for the country?
    • [1] reply
    • My programmer was having the same issues with our Tracking system we built and I completely forgot what he did to fix it.
      • [1] reply
  • I thought that geoip_record_by_name returned an array.
    look here: http://php.net/manual/en/function.ge...rd-by-name.php
    • [1] reply

    • By golly, that's correct! And since OP's code is treating it like a string, it's not going to work.

      OP, you need to look at [country_code] from the array.

      Also, if you have root privileges on your server, and if you're using Apache, you might want to use mod_geoip as it will make this geiop stuff a lot easier (and lookups will be faster!).
      • [ 1 ] Thanks
      • [1] reply

Next Topics on Trending Feed

  • 11

    If someone can please help me with this and tell me why it's not working I would really appreciate it. This is on my tracking server to hand off to Prosper for tracking traffic and routing to different CPA offers. Traffic coming from Facebook for testing. PHP Code: <?php