The following PHP has been working for a couple of years:
<?php
$counter = 0;
$rss = new SimpleXMLElement('http://groups.google.com/group/boy-scout-troop-845/feed/rss_v2_0_msgs.xml', null, true);
?>
It's now generating errors as follows:
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ... parser error : Opening and ending tag mismatch: meta line 1 and head in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ..."></head in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ...
: parser error : Opening and ending tag mismatch: head line 1 and html in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ... in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ... parser error : Premature end of data in tag html line 1 in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: forum/feed/boy-scout-troop-845/msgs/rss_v2_0.xml</a>...</noscript></body></html> in /home/content/t/r/o/troo9757/html/index.php on line 119
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/content/t/r/o/troo9757/html/index.php on line 119
Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/content/t/r/o/troo9757/html/index.php:119 Stack trace: #0 /home/content/t/r/o/troo9757/html/index.php(119): SimpleXMLElement->__construct('... on line 119
Note that I've replaced links by "..." in order to get this accepted. I've looked at the returning XML and it appears fine. Is it possible it's just gotten too long? Any suggestions here?
Thanks!
It looks like Google has changed their RSS feeds to redirect HTTP traffic to HTTPS. If you look at the response of the the XML file you're trying to fetch it actually returns HTML with redirect tags.
Simply call the https directly to get around this.
$rss = new SimpleXMLElement('https://groups.google.com/group/boy-scout-troop-845/feed/rss_v2_0_msgs.xml', null, true);