-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

投稿変数の構文を確認してください (例: 一部の 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 に答える