I
I
Igor2015-06-02 16:21:39
PHP
Igor, 2015-06-02 16:21:39

soap. How to process the response result?

First encountered SOAP.
You need to connect a web service to the site.
I do it like this:

$WDSL = 'http://client.site.com/ws/ProductSearch?wsdl';
$client = new SoapClient($WDSL, array('trace' => 1));
$data = array('Login' => 'login', 'Password' => 'pass', 'SearchCode' => 'oc90', 'Brand' => 'KNECHT');
echo '<pre>';
  print_r($result = $client->SearchByBrands($data));
echo'</pre>';

As a result, I get the answer:
stdClass Object
(
    [return] => stdClass Object
        (
            [ElSearchResult] => Array
                (
                    [0] => stdClass Object
                        (
                            [Code] => 00000054214
                            [Articul] => OC 90
                            [Brand] => KNECHT
                            [SingAnalogue] => Requested
                            [Name] => Фільтр масляний
                            [Store] => Закарпаття
                            [Price] => 2.12
                            [Balance] => 8
                            [Currency] => 870
                        )

                    [1] => stdClass Object
                        (
                            [Code] => 00000054075
                            [Articul] => G102/610
                            [Brand] => CHAMPION
                            [SingAnalogue] => CrossCode
                            [Name] => Фільтр масляний
                            [Store] => Закарпаття
                            [Price] => 1.39
                            [Balance] => 5
                            [Currency] => 870
                        )

                )

        )

)

How to display this result in html? Thanks in advance for your help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DevMan, 2015-06-02
@GansikUA

foreach( $result->return->ElSearchResult as $item ) {
    echo $item->Name;
}

P
Pan Propan, 2015-06-02
@mgis

Look here .
Chewed in some detail at the time.

A
alex stephen, 2015-06-02
@berezuev

something like this

$result = $client->SearchByBrands($data);
foreach ($result->return->ElSearchResult as $brand) {
 echo $result["Brand"];
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question