我遇到了一些解析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
答案 0 :(得分:0)
在我看来,您正在处理的“XML”实际上是一个错误页面,在HTML中,由您尝试从中获取XML的服务器返回。
尝试在浏览器中打开要传递给simplexml_load_file()
的网址,或者转出file_get_contents($your_url_here)
的结果,以查看错误消息的实际内容。
答案 1 :(得分:0)
请检查你的帖子变量语法(例如某些api不像html标签等) 找到你的错误位置非常重要。至少使用2种调试方法。
例如,请在下方使用并检查您的发送数据:
file_put_contents("/your folder/page.txt", $post_data);