I’ve this piece of code taken by a .atom document wrapped with file_get_contents:
<entry>
<link type="text/html" rel="alternate" href="..."/>
</entry>
My goal is to extract the first URL into the href attribute in the entry tag, i tried to parse with:
$xml = new SimpleXMLElement($XML_file);
$link = $xml->entry[0]->link;
print $link;
But shell does not give me any output.
Did you try? As your link element looks empty.
And than your php?
That is my point, t is exactly what you try to echo.
to get attributes
http://www.php.net/manual/en/simplexmlelement.attributes.php
outputs: