public function get() { $arLotinfoTypes = $this->getLotinfoTypes(); if (!empty($arLotinfoTypes)) { Common::recRMDir($this->arParams['XML_DIR']); Common::recRMDir($this->arParams['TMP_DIR']); foreach ($arLotinfoTypes as $arType) { $curlResult = Curl::getFile($this->arParams['XML_FILE'], $this->arParams['XML_DIR'], $arType, $this->arParams['API_URL'], ['apiKey' => $this->arParams['API_KEY'], 'cmd' => $this->arParams['API_CMD'], 'getData' => $this->arParams['GET_PARAMS']]); if (!$curlResult or !file_exists($curlResult)) { $this->errors .= \Helper::boldColorText("Curl::getFile error: " . Curl::$ERROR, "red"); } else { try { $parseXml = new ParseXml($curlResult, $this->arParams['TMP_DIR']); $result = $parseXml->getData(); if (!$result) { $this->errors .= \Helper::boldColorText("ObjectType - {$arType}: " . $parseXml->error, "red"); } else { $this->message .= \Helper::boldColorText("ObjectType - {$arType}: Файл получен и обработан", "green"); } } catch (Exception $e) { $this->errors .= \Helper::boldColorText($e->getMessage(), "red"); } } } } else { $this->errors = \Helper::boldColorText("Нет номеров объектов Лотинфо", "red"); } $log = !empty($this->errors) ? \Helper::boldColorText("Errors", "black") . $this->errors : ""; $log .= !empty($this->message) ? \Helper::boldColorText("Messages", "black") . $this->message : ""; file_put_contents($this->arParams['LOG_FILE'], $log, FILE_APPEND); }
function AsDownloaded() { $geoplugin = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $_SERVER['REMOTE_ADDR'])); if (is_numeric($geoplugin['geoplugin_latitude']) && is_numeric($geoplugin['geoplugin_longitude'])) { $lat = $geoplugin['geoplugin_latitude']; $long = $geoplugin['geoplugin_longitude']; //set farenheight for US if ($geoplugin['geoplugin_countryCode'] == 'US') { $tempScale = 'fahrenheit'; $tempUnit = '°F'; } else { $tempScale = 'celsius'; $tempUnit = '°C'; } require_once 'ParseXml.class.php'; $xml = new ParseXml(); $xml->LoadRemote("http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query={$lat},{$long}", 3); $dataArray = $xml->ToArray(); $html = "<center><h2>Weather forecast for " . $geoplugin['geoplugin_city']; $html .= "</h2><table cellpadding=5 cellspacing=10><tr>"; foreach ($dataArray['simpleforecast']['forecastday'] as $arr) { $html .= "<td align='center'>" . $arr['date']['weekday'] . "<br />"; $html .= "<img src='http://icons-pe.wxug.com/i/c/a/" . $arr['icon'] . ".gif' border=0 /><br />"; $html .= "<font color='red'>" . $arr['high'][$tempScale] . $tempUnit . " </font>"; $html .= "<font color='blue'>" . $arr['low'][$tempScale] . $tempUnit . "</font>"; $html .= "</td>"; } $html .= "</tr></table>"; echo $html; } }
<?php /* * Пример для ретейл рокета и яндекс маркета * ЯМ * https://prj.slweb.ru/issues/138746 */ require_once 'data/RetailRocket.data.php'; require_once 'ParseStoreXml.class.php'; $parse = new ParseXml($FileName, $XpathTemplate, $XmlNs); $parse->BasicTagsVerify($BasicTags); $parse->PositiveVerifyFind($PositiveData, $PositiveErrors); $parse->NegativeVerifyFind($NegativeData, $NegativeErrors); //$parse->ContentVerify($SoftwareVerifyId, $SoftwareVerifyName, $ContentSoftwareVerify); //$parse->PriceVerify($DiscountVerify);
<?php /* * Пример для Гугл мерчанта https://prj.slweb.ru/projects/softsoftlineru/wiki/%D0%A4%D0%BE%D1%80%D0%BC%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5_%D1%81%D0%BF%D0%B8%D1%81%D0%BA%D0%B0_%D0%9F%D0%9E_%D0%B4%D0%BB%D1%8F_%D0%B2%D1%8B%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B8_%D0%B2_Google_Merchant */ require_once 'data/GoogleMerchant.data.php'; require_once 'ParseStoreXml.class.php'; $parse = new ParseXml($FileName, $XpathTemplate, $XmlNs); $parse->BasicTagsVerify($BasicTags); $parse->PositiveVerifyFind($PositiveData, $PositiveErrors); $parse->ContentVerify($SoftwareVerifyId, $SoftwareVerifyName, $ContentSoftwareVerify);
<?php /* * Пример для социомантика * https://prj.slweb.ru/projects/softsoftlineru/wiki/Sociomantic * * to do * https://prj.slweb.ru/issues/128824 (решается доп. наборами тестовых данных) * http://release.store.softline.ru.ohm.slweb.ru/autodesk/autodesk-autocad/ * http://release.store.softline.ru.ohm.slweb.ru/autodesk/autodesk-inventor-lt/ * * https://prj.slweb.ru/issues/120765 * https://prj.slweb.ru/issues/129725 (на аналитике) */ require_once 'data/Sociomantic.data.php'; require_once 'ParseStoreXml.class.php'; $parse = new ParseXml($FileName, $XpathTemplate, $XmlNs); $parse->PositiveVerifyFind($PositiveData, $PositiveErrors); $parse->NegativeVerifyFind($NegativeData, $NegativeErrors); $parse->ContentVerify($SoftwareVerifyId, $SoftwareVerifyName, $ContentSoftwareVerify); $parse->ContentVerify($HardwareVerifyId, $HardwareVerifyName, $ContentHardwareVerify);