Paste External Site URL Text

0

I need to get the text between the tags of a site: <a href="">Este Texo</a>

I'm getting your href with this code:

        $dadosSite = file_get_contents($utl);
        $dom = new DOMDocument;
        @$dom->loadHTML($dadosSite);
        $links = $dom->getElementsByTagName('a');

        foreach ($links as $link)
        {
            $termo = 'video';
            $pattern = '/' . $termo . '/';
            if (preg_match($pattern, $link->getAttribute('href')))
            {
                echo $link->getAttribute('href');

            }
        }
    
asked by anonymous 02.03.2018 / 12:13

0 answers