0

Loading a Wordpress RSS feed to embed it on another website in PHP.

simplexml_load_file('http://blog.sporttoury.com/feed');

But I can't get image, category or text of the post.

SimpleXMLElement {#955 ▼
  +"title": "Website. Description of the website"
  +"link": "http://blog.website.com/liktothepost"
  +"pubDate": "Fri, 17 Feb 2017 07:56:43 +0000"
  +"category": SimpleXMLElement {#1131}
  +"guid": "http://blog.website.com/?p=400"
  +"description": SimpleXMLElement {#953}
}

Any idea of what is wrong?

Barry Michael Doyle
  • 7,792
  • 23
  • 75
  • 128
jmunozco
  • 465
  • 1
  • 8
  • 20

1 Answers1

0

Ok, data is there but it is not visible with print_r, var_dump or just dump in Twig. I found the solution here: Reading text in `<![CDATA[...]]>` with SimpleXMLElement

Community
  • 1
  • 1
jmunozco
  • 465
  • 1
  • 8
  • 20