RSS Feed在另一个网站PHP上

时间:2014-06-17 20:21:20

标签: php wordpress rss wordpress-plugin

我在这里有一个问题...我试图在我的网站上显示一个博客(wordpress)的饲料......这就是我所拥有的回报...我已经有了图像,标题和链接帖子......但是描述就像一个xml对象......我试着看了但是我没有成功......有人可以帮助我吗?

  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)

1 个答案:

答案 0 :(得分:1)

您需要使用SimpleXMLElement class的方法来提取所需的信息。因此,例如,要获取标题,请使用$title = $object->title;

其中一些项目本身就是SimpleXMLElement对象。要从中获取信息,只需执行相同的操作:

// assuming the description has a title...

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