2012-12-10 63 views
1

由於某種原因,我用來獲取feedburner計數作爲字符串在我的網站(http://ios-blog.co.uk)使用的腳本已停止工作:(這是它拋出的錯誤:PHP錯誤:SimpleXMLElement :: __構造()

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:

//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);

感謝所有幫助:)

回答