<? // urls.txt should be format of <a href="domain.com"><img src="domain.jpg"></a> // 1 per line $file = "urls.txt"; $fp = file($file); srand((double)microtime()*1000000); $urls = $fp[array_rand($fp)]; echo $urls; ?>