打开和结束标记不匹配:来自Google网上论坛的RSS Feed中的元线1和头部

时间:2013-07-28 15:22:00

标签: rss google-groups

以下PHP已经工作了几年:

<?php
    $counter = 0;
    $rss = new SimpleXMLElement('http://groups.google.com/group/boy-scout-troop-845/feed/rss_v2_0_msgs.xml', null, true);
?>

现在产生的错误如下:

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

请注意,我已用“...”替换了链接,以便接受此操作。我查看了返回的XML,看起来很好。是不是有可能它太长了?这里有什么建议吗?

谢谢!

1 个答案:

答案 0 :(得分:0)

Google似乎已将其RSS源更改为将HTTP流量重定向到HTTPS。如果您查看您尝试获取的XML文件的响应,它实际上会返回带有重定向标记的HTML。

只需直接致电https即可解决此问题。

$rss = new SimpleXMLElement('https://groups.google.com/group/boy-scout-troop-845/feed/rss_v2_0_msgs.xml', null, true);