CoolAffiilate Posted January 6, 2008 Share Posted January 6, 2008 Hello everyone, Maybe you can help me figure out what I am doing wrong. I am trying to split test 2 affiliate links. The user is sent to a PHP file and the file will randomly pick a link, and forward the user. But, the code is not working. Here is what I have tried. Try #1 <?php $webarray = array("http://www.site1.com", "http://www.site2.com", "http://www.site3.com", "http://www.site4.com"; $rand = rand(0,size($webarray)); header( 'Location: '.$webarray[$rand]) ; ?> Gives an Error Line 5. Try #2 <?php $rand = rand(1,2); if($rand =1) header( 'Location: http://www.site1.com' ) ; else header('Location: http://www.site2.com); ?> Just goes to the 1st rand. Will not even go to the 2nd site. Thanks! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.