Multi-threading is certainly an option
<?php
class Fetcher extends Thread {
public function __construct(Threaded $shared, $page) {
$this->shared = $shared;
$this->page = $page;
}
public function run() {
$data = file_get_contents($this->page);
if ($data) {
$this->shared[$this->page] = $data;
}
}
protected $shared;
protected $page;
}
$start = microtime(true);
$shared = new Threaded();
$thread = 0;
$threads = [];
while ($thread++<8) {
$threads[$thread] = new Fetcher($shared, sprintf(
"http://www.google.com/?q=%s", md5(mt_rand())));
$threads[$thread]->start();
}
foreach ($threads as $thread)
$thread->join();
printf("Complete in %.3f seconds:\n", microtime(true)-$start);
foreach ($shared as $page => $data)
printf("\t%s contained %d bytes\n", $page, strlen($data));
?>
I have used nonsense google searches, but the principles are the same.