php - webservice not returning a array -
i need webservice, returning stdclass object ( [getofertasaereasresult] => )
i need return array values.
<?php try { $wsdl_url = 'http://portaldoagente.com.br/wsonlinetravel/funcoes.asmx?wsdl'; $client = new soapclient($wsdl_url); $params = array( 'slojachave' => "y2y4zgrkowu=", ); $return = $client->getofertasaereas($params); print_r($return); } catch (exception $e) { echo "exception occured: " . $e; } ?>
assuming data following:
$return = '<?xml version="1.0" encoding="utf-8"?> <soap12:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org /2001/xmlschema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:body> <getofertasaereasresponse xmlns="http://tempuri.org/"> <getofertasaereasresult>some result content</getofertasaereasresult> </getofertasaereasresponse> </soap12:body> </soap12:envelope>';
try this:
$obj = new simplexmlelement($return); $body = $obj->children('soap12', true)->body->children(); $content = (string) $body->getofertasaereasresponse->getofertasaereasresult; var_dump($content);
Comments
Post a Comment