I am trying to accessing a array, which is return by Soap class. But I am not able to iterate it. Please help. $server_output = curl_exec ($ch);
Variable $server_output has following return from Curl,
CalculatePremiumStructGeneratePolicyResponse Object
(
[GeneratePolicyResult] => <response><policyno></policyno><totalpremium>0</totalpremium><gc_customerid>100000000000192979</gc_customerid><transactionid>FT10317050001414</transactionid><errortext> Error In Proposal Creation. Error in User Entry:
Maximum Days For Past Policy Should Be 7</errortext></response>
[result:CalculatePremiumWsdlClass:private] =>
[lastError:CalculatePremiumWsdlClass:private] =>
[internArrayToIterate:CalculatePremiumWsdlClass:private] =>
[internArrayToIterateIsArray:CalculatePremiumWsdlClass:private] =>
[internArrayToIterateOffset:CalculatePremiumWsdlClass:private] =>
)
I want to convert above into simple array
Array
(
[GeneratePolicyResult] => <response><policyno></policyno><totalpremium>0</totalpremium><gc_customerid>100000000000192979</gc_customerid><transactionid>FT10317050001414</transactionid><errortext> Error In Proposal Creation. Error in User Entry:
Maximum Days For Past Policy Should Be 7</errortext></response>
[result] =>
[lastError] =>
[internArrayToIterate] =>
[internArrayToIterateIsArray] =>
[internArrayToIterateOffset] =>
)
Please help!
Edit Note :- When I try to print gettype($server_output), it says its a string.
After a lot of try and solutions available on Stackflow, none of works, But When i check the type of variable, it was saying string.
gettype($server_output) was printing string.
So It was a string object. SoI decided to take it as string and try to parse it.
$server_output = curl_exec ($ch);
$data = explode(" [GeneratePolicyResult] =>", $server_output);
$data = explode("[result:CalculatePremiumWsdlClass:private]", $data[1]);
And in this way,I have filter the "GeneratePolicyResult"