-1

我在使用一些解析 xml 文件的 php 脚本时遇到问题。这些脚本已经运行了几个月没有错误,今天突然崩溃了。没有对代码或环境进行任何更改。我对php比较陌生,所以任何帮助将不胜感激。

这是我看到的错误:

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
4

2 回答 2

0

请检查您的 post 变量语法(例如,某些 api 不像 html 标签等)。找出您的错误在哪里非常重要。使用至少 2 种调试方法。

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

file_put_contents("/your folder/page.txt", $post_data);
于 2015-04-18T21:10:57.513 回答
0

在我看来,您正在处理的“XML”实际上是一个错误页面,采用 HTML 格式,由您尝试从中获取 XML 的服务器返回。

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

于 2013-04-02T17:59:28.650 回答