I have a question: I've used webservice Json Curl with PHP and in consumption I was returning an array where I could work with the information, now learning SOAP the return is not as satisfying as in JSON, max that I get is an XML return on a single line. Anyone have any tips? Here's my script:
$client = new SoapClient("https://minhaurl.com.br?wsdl",
array('cache_wsdl' => WSDL_CACHE_NONE,'trace' => true,"encoding" => "utf-8","features" => SOAP_SINGLE_ELEMENT_ARRAYS,"exceptions" => true));
$param = array(
'versao' => '3.0',
'cod_input' => 'C',
'cartao' => 'xxxxxxxxxxx',
'proxy' => 'x',
'usr' => 'xxxxxx',
'pwd' => 'jS1_Njg2b8b0WMbU' );
//nome do método
$resultado = $client->consulta_disponivel($param);
echo "<pre>\n";
print_r ($resultado);
echo "</pre>\n";
//Aqui obtenho o retorno:
stdClass Object
(
[return] => LUIZ ALBERTO43326200004787200000000
)
//Usando:
$result1 = ( $client->__getLastResponse());
var_dump($result1 );
//Obtenho:
array(1) {
[0]=>
string(701) "<G_ServApp_Response><consulta_disponivel><nome>LUIZ ALBERTO</nome> <cartao>4332620000478720</cartao><proxy>0</proxy><limite_credito>0</limite_credito><disponivel_saques>0</disponivel_saques><disponivel_compras>0</disponivel_compras><saldo_atual>0</saldo_atual></consulta_disponivel><codigo_retorno>00</codigo_retorno></G_ServApp_Response>"
}
How can I "capture" just the data as in JSON:
Array->nome;
Array->cartao;