39 lines
937 B
PHP
39 lines
937 B
PHP
<?php
|
|
ini_set('display_errors', 1);
|
|
$_SERVER['SERVER_NAME'] = 'tk-ligat.ru';
|
|
require_once('/home/cloud/core/set/tk-ligat.ru.php');
|
|
require_once('/home/cloud/core/api/php/db.php');
|
|
|
|
require_once('/home/cloud/core/api/php/json.php');
|
|
$curl = curl_init('https://api.samsonopt.ru/v1/sku/?api_key=3f8f720d5a2923a1ff02be994090b002&pagination_page=3');
|
|
$arHeaderList = array();
|
|
$arHeaderList[] = 'Accept: application/json';
|
|
$arHeaderList[] = 'User-Agent: string';
|
|
$arHeaderList[] = 'Accept-Encoding: gzip';
|
|
|
|
|
|
curl_setopt($curl, CURLOPT_HTTPHEADER, $arHeaderList);
|
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
|
|
curl_setopt($curl, CURLOPT_ENCODING, 'gzip');
|
|
$result = json::from_j(curl_exec($curl))['data'];
|
|
curl_close($curl);
|
|
|
|
//print_r($result);
|
|
|
|
|
|
for ($i=0; $i<count($result);$i++){
|
|
|
|
|
|
$json=json::to_j($result[$i]);
|
|
DB::add("INSERT INTO `samsonj` (`json`) VALUES (?)", $json);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|