SimpleXML namespace and attributes of the tags?

Trying to put the data about the user of LiveJournal. Read online it to SimpleXML:
$input_xml = simplexml_load_string(file_get_contents(''));

Since XML is unusual there, and with many namespaces, to retrieve a payload you need to load the descriptions of the namespaces. For example, get the name and date of birth of the user:
$person = $input_xml->children('');
echo $person->Person->name.'<br>';
echo $person->Person->dateOfBirth;

Now I'm trying to extract the creation date of the blog, do the following:
$blog = $person->Person->weblog->children('');

Now if you do a var_dump() the variable $blog, we see the following:
object(SimpleXMLElement)#4 (1) {
 array(2) {
 string(19) "2008-12-15T18:00:10"
 string(19) "2012-03-16T09:49:22"

However, calling $blog->attributes() causes the error "Warning: var_dump(): Node no longer exists in /var/www/test.php on line 45", associative array $blog['dateCreated'] doesn't work either. What am I doing wrong?

Example parse XML file
October 8th 19 at 00:13
2 answers
October 8th 19 at 00:15
to this tag in the $tag, then try this:

$attr = $tag->attributes("lj", 1);
$dc = $attr["dateCreated"];
Changed this:
$blog = $children->Person->weblog->children('');

$blog = $children->Person->weblog;
$attr = $blog->attributes('lj', 1);
$created_at = (string) $attr['dateCreated'];

In the end everything turned out. Thank you! - Jessik commented on October 8th 19 at 00:18
health ) you're welcome)) - clementine_Trembl commented on October 8th 19 at 00:21
October 8th 19 at 00:17
The problem is that the attribute name has a ' @ ' symbol, the solution — to convert an object into an associative array, and access the attribute as array element:
attributes is not the name of the attribute. The tag that I'm trying to "decode" it looks like this:
<foaf:weblog rdf:resource="" lj:datecreated="2008-12-15T18:00:10" lj:datelastupdated="2012-03-16T09:49:22">

As you see, there in sight there is no attribute "attributes". What about dogs: as far as I remember refers to the protected-object properties. I.e. "@attributes" means non-public property $blog->attributes, in which are contained, I need the attributes that I'm trying to make.

The problem is that it is protected (protected) and directly read it not only through the $blog->attributes(), which, as I said above, for some reason returns an error, the node does not already exist. - Jessik commented on October 8th 19 at 00:20

Find more questions by tags PHP