I generate a regular link in p202 but now I want to include a geo script in between the process and things are starting to get a little complicated...So here's what I wanna do:
I created a folder on my tracking domain and put the geo script into it, my fb campaign url is:
http://tracker.com/geouk/?t202kw=kw1
http://tracker.com/geouk/?t202kw=kw2
http://tracker.com/geouk/?t202kw=kw3
.....and on for each ad...
here's the index.php file inside of the "geouk" folder:
[PHP]<?php
$c1 = $_GET['c1'];
$c2 = $_GET['c2'];
$c3 = $_GET['c3'];
$c4 = $_GET['c4'];
$t202kw = $_GET['t202kw'];
// ccr.php - country code redirect
require_once('../geo.php');
$geoplugin = new geoPlugin();
$geoplugin->locate();
$country_code = $geoplugin->countryCode;
switch($country_code) {
case 'US':
header('Location: http://tracker.com/tracking202/redirect/dl.php?t202id=1&t202kw=');
exit;
case 'CA':
header('Location: http://tracker.com/tracking202/redirect/dl.php?t202id=1&t202kw=');
exit;
default: // exceptions
header('Location: http://tracker.com/tracking202/redirect/dl.php?t202id=1&t202kw=');
exit;
}
?>[/PHP]
I already put the GET function there, what I am stuck is, what to put right after this link http://tracker.com/tracking202/redir...02id=1&t202kw=. I tried both "$t202kw" and "<?php echo $_GET["t202kw"]; ?>" but it doesn't work. The variables work when I put it on a regular php page, doesn't work here though, probably because it's a redirect and the code is in the header section? I'm pretty much a php noob, anyone can shed some light on it?
Thanks a ton!
Ohhhhh damn, just took a few minutes searching it in Google and already figured it out.
If anyone wants to do the same thing, here's the code to use..
[PHP]
<?php
$c1 = $_GET['c1'];
$c2 = $_GET['c2'];
$c3 = $_GET['c3'];
$c4 = $_GET['c4'];
$t202kw = $_GET['t202kw'];
// ccr.php - country code redirect
require_once('../geo.php');
$geoplugin = new geoPlugin();
$geoplugin->locate();
$country_code = $geoplugin->countryCode;
switch($country_code) {
case 'US':
header('Location: http://tracker.com/tracking202/redirect/dl.php?t202id=1&t202kw='.$t202kw);
exit;
case 'CA':
header('Location: http://tracker.com/tracking202/redirect/dl.php?t202id=1&t202kw='.$t202kw);
exit;
default: // exceptions
header('Location: http://tracker.com/tracking202/redirect/dl.php?t202id=1&t202kw='.$t202kw);
exit;
}
?>[/PHP]
yep, you got it. you could also use double quotes on header("Location: http://xxx.com"); to embed the $c1 ---> $t202kw variables. WIth single quotes in PHP you can't embed. This should work as well.
[php]
<?php
$c1 = $_GET['c1'];
$c2 = $_GET['c2'];
$c3 = $_GET['c3'];
$c4 = $_GET['c4'];
$t202kw = $_GET['t202kw'];
// ccr.php - country code redirect
require_once('../geo.php');
$geoplugin = new geoPlugin();
$geoplugin->locate();
$country_code = $geoplugin->countryCode;
switch($country_code) {
case 'US':
header("Location: http://tracker.com/tracking202/redirect/dl.php?t202id=1&c1=$c1&c2=$c2&c3=$c3&t202kw=$t202k w");
exit;
case 'CA':
header("Location: http://tracker.com/tracking202/redirect/dl.php?t202id=2&c1=$c1&c2=$c2&c3=$c3&t202kw=$t202k w");
exit;
default: // exceptions
header("Location: http://tracker.com/tracking202/redirect/dl.php?t202id=3&c1=$c1&c2=$c2&c3=$c3&t202kw=$t202k w");
exit;
}
?>
[/php]
&c1=$c1
&c2=$c2
&t202kw=$t202kw
etc..