I usually use the code below to split test landing pages. It only passes the kw variable.
What changes should i make if i want to add in say 'kw' and 'c1' ?
What changes should i make if i want to add in say 'kw' and 'c1' ?
<?php
$kw = $_GET['kw'];
$cloaked = 'http://xxxxx.com/offerx/lp1.php?t202id=21398&t202kw=';
$real[] = 'http://xxxxx2.com/index.php?t202id=114&t202kw=';
$real[] = 'http://xxxxx3.com/index.php?t202id=314&t202kw=';
$myFile = "counter.txt";
// Open the txt file
$fh = @fopen($myFile, 'r');
$offerNumber = @fread($fh, 5);
@fclose($fh);
// See which landing page is next in line to be shown.
if ($offerNumber >= count($real)-1) {
$offerNumber = 0;
} else {
$offerNumber = $offerNumber + 1;
}
// Write to the txt file.
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $offerNumber . "\n";
fwrite($fh, $stringData);
fclose($fh);
$real = $real[$offerNumber].$kw;
// Set this to $cloaked or $real
$location = $real;
header('Location: '.$location);
?>