Answer the question
In order to leave comments, you need to log in
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>';
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
)
)
)
)
Answer the question
In order to leave comments, you need to log in
foreach( $result->return->ElSearchResult as $item ) {
echo $item->Name;
}
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 questionAsk a Question
731 491 924 answers to any question