首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PHP错误: SimpleXMLElement::__construct()

PHP错误: SimpleXMLElement::__construct()
EN

Stack Overflow用户
提问于 2012-12-11 06:56:50
回答 2查看 3.6K关注 0票数 1

由于某些原因,我用来获取feedburner计数的脚本(http://ios-blog.co.uk)停止工作:(这是它抛出的错误:

代码语言:javascript
复制
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 2:     parser error : Opening and ending tag mismatch: meta line 1 and HEAD in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: <TITLE>301 Moved</TITLE></HEAD><BODY> in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 6: parser error : Opening and ending tag mismatch: HEAD line 1 and HTML in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: </BODY></HTML> in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 7: parser error : Premature end of data in tag HTML line 1 in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: in /home/connect.php on line 83

Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: ^ in /home/connect.php on line 83

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/connect.php:83 Stack trace: #0 /home/connect.php(83): SimpleXMLElement->__construct('<HTML><HEAD><me...') #1 {main} thrown in /home/connect.php on line 83

这是我正在使用的PHP:

代码语言:javascript
复制
//get cool feedburner count
$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=iosdevblog";

//Initialize the Curl session
$ch = curl_init();

//Set curl to return the data instead of printing it to the browser.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

//Set the URL
curl_setopt($ch, CURLOPT_URL, $whaturl);

//Execute the fetch
$data = curl_exec($ch);

//Close the connection
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
echo $fb;
//end get cool feedburner count

该文件很大-其中显示与之相关的行83$xml = new SimpleXMLElement($data);

感谢所有人的帮助:)

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-12-11 10:05:31

啊..。feedburner现在已被弃用-这就是它突然停止的原因:( https://developers.google.com/feedburner/

票数 2
EN

Stack Overflow用户

发布于 2012-12-11 08:48:42

看看这里的这条线

警告: SimpleXMLElement::__construct() simplexmlelement元素。--构造: 301移入/home/connect.php的第83行

它给出了HTTP代码301已移动。

如果您访问此链接

https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri=iosdevblog

它实际上是404ing,没有XML。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13810750

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档