I am attempting to pull the RSS 2.0 feed for a Facebook Fan page from within PHP.
When I access the feed from the browser, no problems. But, when I attempt to pull and use in PHP, Facebook returns code to redirect to a “Upgrade Your Browser” notice. The same happens when I attempt to validate the feed using W3C RSS validator.
So, Facebook must have some logic in place that analyzes the user agent and either delivers the feed, or the “you must update” page.
The question is: how do I get access to that RSS feed from within PHP?
Can I forge user agent headers directly when using SimpleXML or DOMdocument? I know there is an option to pull the feed using CURL (where the headers can be easily set), but I’d prefer not to do so.
Any ideas are welcome!
Well for those that might also be curious,
ini_set()seems to be one solution.Although, when Zuckberberg feels like updating user agent requirements, who knows whether this will validate.