<?php
// Отправляем запрос на получение категорий каталогоа в JSON
$curl_0 = curl_init("https://api.site.ru/v1/category/?api_key=a6eae107c640e81ea44d94014a52fe80");
$curl_1 = curl_init("https://api.site.ru/v1/assortment/index.php?pagination_page=1&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$curl_2 = curl_init("https://api.sitt.ru/v1/assortment/index.php?pagination_page=2&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$curl_3 = curl_init("https://api.site.ru/v1/assortment/index.php?pagination_page=3&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$curl_4 = curl_init("https://api.site.ru/v1/assortment/index.php?pagination_page=4&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$curl_5 = curl_init("https://api.site.ru/v1/assortment/index.php?pagination_page=5&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$curl_6 = curl_init("https://api.site.ru/v1/assortment/index.php?pagination_page=6&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$curl_7 = curl_init("https://api.site.ru/v1/assortment/index.php?pagination_page=7&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$curl_8 = curl_init("https://api.site.ru/v1/assortment/index.php?pagination_page=8&api_key=a6eae107c640e81ea44d94014a52fe80&response_format=xml");
$arHeaderList = array();
$arHeaderList[] = 'Accept: application/json';
$arHeaderList[] = 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36 OPR/65.0.3467.78';
curl_setopt($curl_0, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_0, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_0, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_1, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_1, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_1, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_2, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_2, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_3, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_3, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_3, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_4, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_4, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_4, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_5, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_5, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_5, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_6, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_6, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_6, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_7, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_7, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_7, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl_8, CURLOPT_HTTPHEADER, $arHeaderList);
curl_setopt($curl_8, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_8, CURLOPT_FOLLOWLOCATION, true);
$m_curl = curl_multi_init();
curl_multi_add_handle($m_curl,$curl_0);
curl_multi_add_handle($m_curl,$curl_1);
curl_multi_add_handle($m_curl,$curl_2);
curl_multi_add_handle($m_curl,$curl_3);
curl_multi_add_handle($m_curl,$curl_4);
curl_multi_add_handle($m_curl,$curl_5);
curl_multi_add_handle($m_curl,$curl_6);
curl_multi_add_handle($m_curl,$curl_7);
curl_multi_add_handle($m_curl,$curl_8);
do {
$result = curl_multi_exec($m_curl, $active);
if ($active) {
curl_multi_select($m_curl);
}
} while ($result != -1);
curl_multi_close($m_curl);
if($result){
echo "<hr/>" . "Данные от поставщика получены;" . "<br/>";
} else { echo "<hr/>" . "Данные от поставщика не получены;" . "<br/>";
}
return $result;