// Работать с SOAP очень просто.
$client = new SoapClient('https://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx?WSDL');
// можем посмотреть список доступных методов
print_r($client->__getFunctions());
// теперь можно вызвать метод с нужным параметром. Вернет объект.
$result = $client->GetCursOnDateXML(['On_date' => '2019-08-09']);
// Так как разработчики в cbr не компетентны и не умеют работать полноценно с SOAP, то они прибегают
// к механике:- "Главное нам хорошо, а все остальные пусть крутятся"
// Ответ возвращается ввиде XML, а не структурой, поэтому нужно этот ответ преобразовать в массив.
print_r(simplexml_load_string($result->GetCursOnDateXMLResult->any));
function getMinDate($now){
$now = strtotime($now);
return date("d", $now) <= 5 ? date("Y-m-01", strtotime('-1 month', $now)) : date("Y-m-01", $now);
}
print getMinDate('2019-08-05') . "\n";
print getMinDate('2019-08-08') . "\n";
MySQL server has gone away
INSERT INTO table1 (column1, column2, column3, ...)
SELECT t2.column1, t2.column2, t2.column3, ...
FROM table2 t2
WHERE condition
ON DUPLICATE KEY UPDATE
column2 = VALUES(column2),
column3 = VALUES(column3),
...
;
SOURCE /path/filename.sql;
SimpleXMLElement Object
(
[Element] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2235961003
[Name] => OSAGO_FR_CARCTG
[Value] => 8244
[Save] => N
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2235961103
[Name] => OSAGO_FR_AGRPERIODM
[Value] => 12
[Save] => N
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2235961203
[Name] => OSAGO_FR_USEPERIOD
[Value] => 12
[Save] => N
)
)
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2235961303
[Name] => OSAGO_FR_MULTIDRIVE
[Value] => 0
[Save] => N
)
)
[4] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2235961403
[Name] => OSAGO_FR_TAXI
[Value] => 1
[Save] => N
)
)
[5] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2235961703
[Name] => OSAGO_FR_SBJTYPE
[Value] => N
[Save] => N
)
)
[6] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2264076003
[Name] => OSAGO_FR_TARIFFZONE
[Value] => 3401214003
[Save] => N
)
)
[7] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2496138003
[Name] => FR_KE2
[Value] => .93
[Save] => Y
)
)
[8] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 2685741203
[Name] => KVS_OSAGO
[Value] => .93
[Save] => Y
)
)
[9] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 4655146503
[Name] => FR_USEWITHTRAILER
[Value] => 1
[Save] => N
)
)
[10] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 761850500
[Name] => TRF_CL_BASE
[Value] => 7399
[Save] => Y
)
)
[11] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 761851700
[Name] => TRF_CL_ZONE
[Value] => 1.8
[Save] => Y
)
)
[12] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 761851800
[Name] => TRF_CL_BONUSMALUS
[Value] => 1
[Save] => Y
)
)
[13] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 761854000
[Name] => TRF_CL_POWER
[Value] => 1
[Save] => Y
)
)
[14] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 761854100
[Name] => TRF_CL_PERIOD
[Value] => 1
[Save] => Y
)
)
[15] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 765909400
[Name] => TRF_CL_ABUSE
[Value] => 1
[Save] => Y
)
)
[16] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Isn] => 816328000
[Name] => TRF_CL_MULTIDRIVE
[Value] => 1
[Save] => Y
)
)
)
)
;extension=php_memcache.dll