XML导入脚本错误 - simplexml_load_string

时间:2015-07-13 15:06:37

标签: xml xpath import simplexml-load-string

我有一个XML导入脚本,它使用“simplexml_load_string”来导入房地产属性Feed。该脚本计划每晚凌晨1点运行。

它已经好几个月了;但昨天它开始出现以下错误:

PHP Warning:  simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]:
Entity: line 2: parser error : Extra content at the end of the document in /public_html/import/import-script.php on line 26

PHP Warning:  simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: &lt;body&gt;&lt;h1&gt;Object Moved&lt;/h1&gt;This object may be found &lt;a HREF=&quot;http://admin.homees in /public_html/import/import-script.php on line 26

PHP Warning:  simplexml_load_string() [<a href='function.simplexml-load-string'>function.simplexml-load-string</a>]: ^ in /public_html/import/import-script.php on line 26

PHP Fatal error:  Call to a member function xpath() on a non-object in /public_html/import/import-script.php on line 28
Status: 500 Internal Server Error
X-Powered-By: PHP/5.2.17
Content-type: text/html

我无法理解为什么会出现这个错误;因为Feed仍然在浏览器中打开,一切正常。加上W3C也可以验证它。

任何人都可以解释这个错误意味着什么/为什么我会看到它?

我还检查了服务器日志,它说: [错误] [客户端46.208.46.63:41713] AH01215:PHP致命错误:在第30行的/public_html/import/import-script.php中的非对象上调用成员函数xpath()

这是我们的PHP导入脚本的片段:

$ch2 = curl_init();
$timeout = 60; 
curl_setopt ($ch2, CURLOPT_URL, "external-website/provided-feed.xml");
curl_setopt ($ch2, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch2, CURLOPT_CONNECTTIMEOUT, $timeout);
$xmlstring = curl_exec($ch2);
curl_close($ch2); 

$xml = simplexml_load_string($xmlstring);
$propertys = $xml->xpath("//property");
$count=0;

提前感谢!克雷格。

0 个答案:

没有答案
相关问题