D
D
druzhanja2015-06-19 10:33:34
PHP
druzhanja, 2015-06-19 10:33:34

How to get category data from term attribute in PHP using simplexml_load_file?

How to get the contents of the term attribute from the princesscoloringpages.blogspot.com/atom.xml?redire... page:

<entry><title type='text'>PRINCESS COLORING PAGES</title><category scheme="http://www.blogger.com/atom/ns#" term="PRINCE"/><category scheme="http://www.blogger.com/atom/ns#" term="PRINCESS"/></entry>

<?php
$url= "http://princesscoloringpages.blogspot.com/atom.xml?redirect=false&start-index=1&max-results=450";
$str = simplexml_load_file("$url");
 foreach ($str->entry as $item)
        {
            $title = $item->title;  // это работает
        }
?>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
krypt3r, 2015-06-19
@krypt3r

$item->attributes()->term;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question