Returning only one result, how to return all?

Asked

Viewed 41 times

0

Please someone help me, I need to return all the data. but it only returns the first one how do I return all results , the code I am using is this

try {
    $opts = array(
        'http' => array(
            'user_agent' => 'PHPSoapClient'
        )
    );
    $context = stream_context_create($opts);

$wsdlUrl = 'xxx';

$soapClientOptions = array(
    "login"      => "xxxx",
    "password"  => "xxxx",
    "stream_context" => $context,
    "cache_wsdl" => WSDL_CACHE_NONE
);

$client = new SoapClient($wsdlUrl, $soapClientOptions);

echo $status =  (string) simplexml_load_string(

$client->RealizarConsultaSQL
([
  'codSentenca'   => 'xxxx',
  'codColigada'   => 'xxxx',
  'codSistema'    => 'xxxx',
  'parameters'    => 'xxxx'
])
->RealizarConsultaSQLResult)->Resultado->xxx;

}
catch(Exception $e) {
  //  echo $e->getMessage();
}

inserir a descrição da imagem aqui

This is the return by SOAPUI, look how it returns all the results! more in the code above it only appears the first so:

inserir a descrição da imagem aqui

  • 1

    You just gave a echo; if there are multiple records you should not have a repeat loop?

  • Good afternoon! I am not managing to make that loop I have tried all! can help me.. I just need it to finish, help me!

  • Have you tried giving a var_dump on the object that is the result of simplexml_load_string? It would be good for you to do this and [Dit] your question to add this result. That way your problem would be seen quickly by the community and solved quickly.

  • Good afternoon Hoping, I was able to solve the problem was just removing ->Result->xxx; and now bringing all the results! print_r($arr = json_encode($status_CODIGO , 1); now how do I handle it in my JS? wanted to bring the result to a select within my html

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.