Jump to content

PHP Redirect to Alternate Affiliate links


ams007

Recommended Posts

Good Morning,

 

I am sending traffic to a page which meta-refreshes to an affiliate program. I would like to use php to alternate the redirect between 2 or 3 affiliate links so I can see which converts better.

 

I know it should be rather simple for anybody who knows php, but I am just a beginner. Please help.

 

Thanks,

AMSCS

 

<?php

$links = array();

$links[] .= "http://first_link.com";

$links[] .= "http://second_link.com";

//and so on and so forth....

$last = count($links) - 1;

$choice = rand(0, $last);

header("location". $links[$choice]);

?>

 

Looks great, tried it, but all I get is a blank html page. Please relook at the code and see if it's correct.

 

Thanks,

Al Soto

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.