I am creating a facebook feed plugin for wordpress and have it working when it is using a local file however I need to load into $fb = new SimpleXMLElement($xmlstr);.
$xmlstr is a variable with the XML in, the content inside that file is from here https://www.facebook.com/feeds/page.php?format=rss20&id=133869316660964 .
Is it possible with SimpleXMLElement to store data from a webpage?
I tried using file_get_contents but it didn’t work. When I use that function facebook gives this error: https://i.stack.imgur.com/BKzzM.jpg when using this code: echo "contents: " . file_get_contents('https://www.facebook.com/feeds/page.php?format=rss20&id=133869316660964');
I solved this using the cURL library from PHP.
From there I set the simple xml as $data.
Hope this helps people in the future!
It’s important to have:
Because otherwise facebook will think you’re using an out of date browser.