Forum Moderators: coopster

Message Too Old, No Replies

A/B Testing

         

dnathan

5:26 pm on Sep 8, 2008 (gmt 0)

10+ Year Member



An earlier, locked thread had this code for a split test:

<?
$list = "url1.html, url2.html";

function file_get_contents_randomly($list) {
if (strpos($list,",")) {
$urlArray = explode(",",$list);
$randUrl = array_rand($urlArray,sizeof($urlArray));
for ($sk=0; $sk<sizeof($randUrl); $sk++) {
if ($landingpage=file_get_contents($urlArray[$randUrl[$sk]])) {
return $landingpage;
}
}
}
return "No page Found.";
}

echo file_get_contents_randomly($list);
?>

I'd like to use this to test one affiliate offer vs. another one.

This script works well EXCEPT for the following:
* URL in address bar is not reflecting the new page.
* Images aren't loading from the affiliate site.

Does anyone have an edit to the above script to make this work?

THANKS A MILLION!

cameraman

6:32 pm on Sep 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The address bar isn't changing because you're not actually sending it to the url, you're staying at your web site.
More than likely the images aren't showing up because the pages are using relative addresses for them. A base href would probably work unless the target is preventing image hotlinking.