Quantcast
Viewing latest article 2
Browse Latest Browse All 25

Zend_Feed_Rss - I can echo but I can't do anything else?

I would like to retrieve some feed news from a given feed source, only if a specific tag is the case.

I'm not getting it, because $category is not a string, hence strschr will not returned. (so I believe).

 function ultimasNoticiasBlog()   {        $channel = new Zend_Feed_Rss('http:/something.com/?feed=rss2');        $news = array();        foreach ($channel as $item) {            foreach ($item->category as $category)            {                //if any of the news has the tag "Sugestão"                if (strchr($category,'Sugestão'))                {                    $news['find'] = "I have found a feed with your tag";                }                else                {                    echo 'Found Nothing';                }            }          return $news;      }   }

However, if I do:echo $category" I get all categories printed on the viewport.

What am I not getting here? Please advice,MEM

UPDATE:To put it simple:If I do:var_dump($category); I get:

object(Zend_Feed_Element)#159 (3) {  ["_element:protected"]=>  object(DOMElement)#165 (0) {  }  ["_parentElement:protected"]=>  NULL  ["_appended:protected"]=>  bool(true)}object(Zend_Feed_Element)#156 (3) {  ["_element:protected"]=>  object(DOMElement)#166 (0) {  }  ["_parentElement:protected"]=>  NULL  ["_appended:protected"]=>  bool(true)}

If I do:echo $category;

I get on the view port:SugestaoAnotherTag1AnotherTag2 ...

I'm not understanding why and, more important, I'm not seeing how can I then see if "Sugestao is the case or not". :s


Viewing latest article 2
Browse Latest Browse All 25

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>