2013-06-26 84 views
0

我正在創建連接到web服務的php頁面,並將顯示來自web服務的結果 Web服務響應的xml如下所示:(已解決)查看xml內容結果來自於web服務響應php

<GetUserResponse xmlns="http://the web service"> 
    <GetUserResult> 
    <xsd:schema>schema</xsd:schema>xml 
    </GetUserResult> 
</GetUserResponse> 

我需要知道XML內容,我從服務, 瞭如何對付它或我的網頁顯示呢?


我能夠使用來解決這個問題:

$ XML = simplexml_load_string($結果);

感謝,

回答

0

這是非常簡單的解決方案適用於php.net簡單read this

+0

更新我的問題,你可以檢查它,請 –

+0

我覺得你與API工作。如果是,那麼使用回調函數... –

0
XML File : myxml.xml 
<?xml version="1.0" encoding="ISO-8859-1"?> 
<note> 
    <to>Gauttam</to> 
    <from>Kevadia</from> 
    <heading>My Heading</heading> 
    <body>Body Content Here!!!!</body> 
</note> 

TO read in PHP return with Object : 

<?php 
    $xml=simplexml_load_file("myxml.xml"); 
    echo $xml->to . "<br>"; 
    echo $xml->from . "<br>"; 
    echo $xml->heading . "<br>"; 
    echo $xml->body; 
    // IF XML file having multiple value retrieve it dynamic with array 
?>