Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <pre>
- <?php
- ini_set("memory_limit", "1024M");
- $login = "***";
- $password = "***";
- $soapClientParamsCatalog = array('connection_timeout' => 300);
- $soapClientCatalog = new
- SoapClient("https://api.treolan.ru/webservices/treolan.wsdl",
- $soapClientParamsCatalog);
- try {
- $paramCatalog = array(
- 'Login' => $login,
- 'password' => $password,
- 'category' => '',
- 'vendorid' => 0,
- 'keywords' => '',
- 'criterion' => 0,
- 'inArticul' => 0,
- 'inName' => 0,
- 'inMark' => 0,
- 'ShowNc' => 0);
- $infoCatalog = $soapClientCatalog->__call("GenCatalogV2", $paramCatalog);
- $arResult = ($infoCatalog['Result']);
- $xmlCatalog = simplexml_load_string($arResult);
- $jsonCatalog = json_encode($xmlCatalog);
- $xmlArrCatalog = json_decode($jsonCatalog, true);
- function recarray($ar, $searchfor) {
- static $result = array();
- foreach($ar as $k => $v) {
- if ($k === $searchfor) $result[] = $v;
- if (is_array($ar[$k])) recarray($v, $searchfor);
- }
- return $result;
- }
- $result = recarray($xmlArrCatalog, 'articul');
- }
- catch (SoapFault $fault) {
- print("Sorry, WS returned the following ERROR:
- ".$fault->faultcode."-".$fault->faultstring);
- }
- $soapClientParamsProducts = array('connection_timeout' => 300);
- $soapClientProducts = new
- SoapClient("https://api.treolan.ru/webservice2008/Service.asmx?wsdl",
- $soapClientParamsProducts);
- try {
- foreach ($result as $i => $articuls) {
- $paramProducts = array(
- 'Login' => $login,
- 'password' => $password,
- 'Articul' => $articuls);
- $infoProducts = $soapClientProducts->__call("ProductInfoV2", array($paramProducts));
- $xmlProducts = simplexml_load_string($infoProducts->ProductInfoV2Result->any);
- $jsonProducts = json_encode($xmlProducts);
- $xmlArrProducts = json_decode($jsonProducts, true);
- $res[] = $xmlArrProducts;
- }
- print_r($res);
- }
- catch (SoapFault $fault) {
- print("Sorry, WS returned the following ERROR:
- ".$fault->faultcode."-".$fault->faultstring);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement