0
I need to get the text between the tags of a website:
<a href="">Este Texo</a>
I’m getting a hold of 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');
}
}
Utilize
$link->textContent;
to capture the value of tag content.– Valdeir Psr
@Valdeirpsr Ball show, perfect
– sNniffer