All pastes #386417 Raw Edit

BC

public text v1 · immutable
·published 2007-03-08 16:20 UTC
rendered paste body
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);
for ($i=0, $i<count($remoteurls), $i++) {
  $grabbedurls[$i] = CurlGrab($remoteurls[$i]);
}

// $grabbedurls is an array containing the content of every grabbed url listed in listofurls.txt