I need to access the response from a .NET web service which returns data in XML format. How can I split the data returned? For example, I would like to parse the data into some PHP variables:
$name = "Dupont";
$email = "[email protected]";
I have been looking for how to do this for a long time without finding the correct way to do it.
My script is:
$result = $client->StudentGetInformation($params_4)->StudentGetInformationResult;
echo "<p><pre>" . print_r($result, true) . "</pre></p>";
The echo in my page is:
stdClass Object
(
[any] => 0Successful10371DupontCharlescharles.dupont@[email protected] FINANCE1778AAA Département
)
The webservice response format is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<StudentGetInformationResponse xmlns="http://tempuri.org/">
<StudentGetInformationResult>xml</StudentGetInformationResult>
</StudentGetInformationResponse>
</soap:Body>
</soap:Envelope>
I have tried your example. But it doesn't do what i need. I need to split the value returned. I would like to get the data and put them into PHP variables:
$name = "Dupont"; $email = "[email protected]"; etc...
Unfortunately the echo of your example gives:
object(stdClass)#1 (1) { ["StudentGetInformationResult"]=> object(stdClass)#11 (1) { ["any"]=> string(561) "0Successful10371DupontCharlescharles.dupont@[email protected] FINANCE1778AAA Département" } }
SoapClientphp.net/manual/en/class.soapclient.php works like charm