function CurlGrab($remoteurl) { $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, $remoteurl); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); $contents = curl_exec($ch); curl_close($ch); return $contents; } $remoteurls = array(); $grabbedurls = array(); $urlhandle = fopen("./listofurls.txt", r); while (!feof($urlhandle)) { $remoteurls[] = fgets($urlhandle); } fclose($urlhandle); $maxcount = count($remoteurls) - 1; for ($i=0, $i<$maxcount, $i++) { $grabbedurls[$i] = CurlGrab($remoteurls[$i]); } // $grabbedurls is an array containing the content of every grabbed url listed in listofurls.txt