Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

A/B Testing

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

Junior Member

10+ Year Member

joined:Jan 27, 2004
posts: 41
votes: 0

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?


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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 16, 2007
votes: 0

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.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members