2013-04-01 99 views
-1

我遇到了一些解析XML文件的PHP脚本的麻烦。这些脚本几个月来一直运行无误,并且今天突然全部崩溃。代码或环境未做任何更改。我相对较新的PHP,所以任何帮助,将不胜感激。simplexml警告和错误

下面是我看到的错误:

Warning: simplexml_load_file() [function.simplexml-load-file]: c:/server/public_html/dev/temp.xml:1: parser error : Opening and ending tag mismatch: HR line 1 and body in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]: LED).</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body> in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]:^in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]: c:/server/public_html/dev/temp.xml:1: parser error : Opening and ending tag mismatch: HR line 1 and html in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]: u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body></html> in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]:^in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]: c:/server/public_html/dev/temp.xml:1: parser error : Premature end of data in tag body line 1 in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]: u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body></html> in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]:^in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]: c:/server/public_html/dev/temp.xml:1: parser error : Premature end of data in tag html line 1 in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]: u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.32</h3></body></html> in C:\Server\public_html\dev\index.php on line 31 

Warning: simplexml_load_file() [function.simplexml-load-file]:^in C:\Server\public_html\dev\index.php on line 31 

Warning: Invalid argument supplied for foreach() in C:\Server\public_html\dev\index.php on line 35 
+0

我们可以看到你正在试图加载XML?看起来它实际上是HTML,它不是有效的XML。 – halfer

回答

0

在我看来像“XML”你正在处理实际上是一个错误页面,在HTML中,由您试图获取XML服务器返回从。

尝试在浏览器中打开您传递给simplexml_load_file()的URL,或者倾销file_get_contents($your_url_here)的结果以查看错误消息实际说的内容。

0

请检查您的帖子变量语法(例如某些apis不像html标签等) 找到您的故障位置非常重要。使用至少2个调试方法。

例如使用下面并检查发送数据:

file_put_contents("/your folder/page.txt", $post_data);