Redirect visitor to affiliate's replicated page

If you want to redirect visitor to affiliate's replicated based on the information from cookie you can use following API code:


$session = new Pap_Api_Session("URL_TO_PAP/scripts/server.php");

// register click
$clickTracker = new Pap_Api_ClickTracker($session);
try {
} catch (Exception $e) {

$refid = 'testaff'; // default affiliate
if ($clickTracker->getAffiliate() != null) {
    $refid =  $clickTracker->getAffiliate()->getValue('refid');

header('Location: URL_TO_REPLICATED_SITE/'.$refid);
Do not forget to modify the code so it uses correct URLs and default affiliate.