"//a/@href"
href="site.com/3572"
href
? Такое:site.com/3572
foreach ($xpath->query('//a/@href') as $href) {
echo $href->nodeValue, PHP_EOL;
}
https://3v4l.org/0XlvA <?php
$XMLResult = '
<root>
<a href="https://google.com/">google.com</a>
<a href="https://bing.com/">bing.com</a>
<a href="https://yahoo.com/">yahoo.com</a>
</root>';
$XML = simplexml_load_string($XMLResult);
$XMLResults = $XML->xpath('/root/a/@href');
foreach($XMLResults as $SimpleXMLElement) {
var_dump(strval($SimpleXMLElement['href']));
}
string 'https://google.com/' (length=19)
string 'https://bing.com/' (length=17)
string 'https://yahoo.com/' (length=18)