ホームページ >バックエンド開発 >PHPチュートリアル >PHPを使用してXML SOAPを読み取る方法
php を使用して XML ソープを読み取ります
別の問題が発生しました。解決するのを手伝ってください
おそらく、この種のファイルにさらされたことがないでしょう。
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?xml version="1.0" encoding="utf-8"?> <envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <body> <queryresponse xmlns="http://tempuri.org/"> <queryresult> Order_flag=0&Name_num=2077&StartCity=SZX&EndCity=PEK&Dates=2012-5-31&.......后面还有好多这样的数据。 </queryresult> </queryresponse> </body> </envelope>
で解析します。 <?php $soap=<<<SOAP <?xml バージョン="1.0" エンコーディング="utf-8"?> <envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="「http://www.w3.org/2001/XMLSchema」"> <石鹸:本体> <queryresponse xmlns="http://tempuri.org/"> Order_flag=0&Name_num=2077&StartCity=SZX&EndCity=PEK&Dates=2012-5-31&....このようなデータは後でたくさんあります。 </queryresponse> </envelope> 石鹸; $xml=simplexml_load_string($soap); $result = $xml->children('http://schemas.xmlsoap.org/soap/envelope/') ->子供('http://tempuri.org/') ->クエリ応答 ->クエリ結果; $result をエコーします。 //Order_flag=0&Name_num=2077&StartCity=SZX&EndCity=PEK&Dates=2012-5-31&....このようなデータは後でたくさんあります。 <div class="clear"></div>