hey ppl ive got a text file with over 500 web addresses, each on there own line between the <loc>http://..........</loc> etc i have a parser that takes one of these links and takes html content out of them i wont to open the document secect a random line and import it as a variable please help
just look up how to read a certain line in a php file, then make a variable with math random between x and y, so it generates the random number, then plug it into the file read code so it reads that line
<?php $file = file_get_contents('addresses.txt'); $array = explode("\n", $file); $random = rand(0, count($array)); $url = $array[$random]; echo $url; ?> PHP: Hope it helps