thiag0ms
thiag0ms

Reputation: 17

RSS Feed on another site PHP

i have a problem here...im trying to show the feed of a blog(wordpress) in my website...and that is the return what i have...i already have the image, title and link of the post...but the description is coming like an xml object...i tried to read that but i had not success...someone can help me??

  object(SimpleXMLElement)[74]
    public 'title' =  string '10 curiosidades sobre a Pizza' (length=29)
    public 'link' =  string 'www.site.com.br/blog/index.php/10-curiosidades-sobre-a-pizza/' (length=71)
    public 'comments' =  string 'www.site.com.br/blog/index.php/10-curiosidades-sobre-a-pizza/#comments' (length=80)
    public 'pubDate' =  string 'Wed, 14 Aug 2013 13:08:49 +0000' (length=31)
    public 'category' =>
      object(SimpleXMLElement)[76]
    public 'guid' =  string 'www.site.com.br/blog/?p=1254' (length=38)
    public 'description' =  
      object(SimpleXMLElement)[75]
    public 'enclosure' =  
      object(SimpleXMLElement)[77]
        public '@attributes' =  
          array (size=3)
          'url' =  string 'www.site.com.br/blog/wp-content/uploads/2013/08/pizza-RC-Fones-150x150.jpg' (length=84)
          'length' =  string '9873' (length=4)
          'type' =  string 'image/jpg' (length=9)

Upvotes: 0

Views: 69

Answers (1)

Kryten
Kryten

Reputation: 15760

You need to use the methods of the SimpleXMLElement class to extract the information you need. So, for example, to get the title, use $title = $object->title;.

Some of those items are themselves SimpleXMLElement objects. To get information out of them, simply do the same thing:

// assuming the description has a title...

$description = $object->description->title;

Upvotes: 1

Related Questions