Ejemplo n.º 1
0
    $x = new DOMXPath($dom);
    $i = 1;
    $node = "";
    $x->preserveWhiteSpace = false;
    foreach ($x->query("//ul[@class='participant-list']//a") as $node) {
        //delay();
        $url = $node->getAttribute('href');
        //echo 'url:'.$url."\n";
        array_push($stack, $url);
        /*
            if($url=""){
                echo 'leeg';
                $end = true;
                if($end){
                  break;
                }
            }else{
                array_push($stack, $url);
                $i++;
               }
        */
    }
}
searchForWord($word, $stack);
function searchForWord($word, $stack)
{
    global $word, $stack;
    $matches = preg_grep('/' . $word . '/', $stack);
    $sites = implode('<br/>', $matches);
    echo $sites;
}
function getLinks($html)
{
    global $i, $stack;
    //check andere bron?
    if (preg_match('/notfound.org/', $html)) {
        foreach ($html->find("ul.participant-list a") as $tag) {
            $stack[$i] = $tag->getAttribute('href');
            $i++;
        }
        return searchForWord($stack);
    }
}