1
I’m having a problem trying to find an element with the exact name.
<?
//...
@$DOM = new DOMDocument;
@$DOM->loadHTML($html);
@$finder = new DomXPath($DOM);
foreach($finder->query("//a[contains(@title, '".$info[$i]."')]") as $link){
echo $l[$i] = $link->getAttribute('href').'<br>';
}
//...
?>
Your answer is several links (taken from getAtrribute()
), hassle-free.
Where is the problem?
I wish I could take just what
title
was the same as$info[$i]
.
Exemplifying (note the title
!):
<a href='1.html' title="biscoito"></a>
<a href='2.html' title="biscoito bolacha"></a>
<a href='3.html' title="bolacha"></a>
If the $info[$i]
had the value of "biscoito
", would be returned:
1.html //oriundo do biscoito
2.html //oriundo do biscoito bolacha
Desired result:
1.html
Solution I need:
There be some function (which I don’t know) that only contains the name, but not only the name. Because I need only where the title
is equal to cookie, but not the cookie.