From last two week I’m getting following php warning message
Warning: DOMDocument::load(): Extra content at the end of the document
in http://widget.stagram.com/rss/n/zee/, line: 10 in
/home//public_html/wp-content/themes//inc/social-instagram.php
on line 22
where I’m trying to parse this link in the warning message
$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);
when I browse the link in web browser http://widget.stagram.com/rss/tag/zee/ the xml seems to be ok.
You need to use curl and add the option
CURLOPT_USERAGENT
. That’s why it’s working on the browser, and not by simplefile_get_contents
or->load
. Consider this example:Sample Output
I had the same problem and found the following solution worked without the need for CURL:
The extra content error went away and all the feeds I pushed through worked fine.
Big thanks to Gordon for answering another question with this answer that led me to try it for this problem.