Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@alfchee
Created October 8, 2015 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfchee/dea80ff19567f35b32bc to your computer and use it in GitHub Desktop.
Save alfchee/dea80ff19567f35b32bc to your computer and use it in GitHub Desktop.
public function recursiveCall($url, $depth)
{
if(!$this->isValid($url,$depth)) {
return;
}
$this->_seen[$url] = true;
$request = new AsyncWebRequest($url);
if($request->start()) {
while($request->isRunning()) {
usleep(100);
}
if($request->join()) {
if($request->response) {
$links = $this->processLinks($request->response,$url,$depth);
foreach($links as $link) {
$this->recursiveCall($link, $depth-1);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment