core/parcer/samson-get-all-tovar.php

24 lines
731 B
PHP
Raw Normal View History

2023-02-08 16:59:59 +05:00
<?php
/*
Получаем список всех товаров самона
*/
require_once('/home/cloud/core/api/php/json.php');
$curl = curl_init('https://api.samsonopt.ru/v1/sku/?api_key=4e2ef85d3ec9e27cc2a148c74a47d804');
$arHeaderList = array();
$arHeaderList[] = 'Accept: application/json';
$arHeaderList[] = 'User-Agent: 4e2ef85d3ec9e27cc2a148c74a47d804';
$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 = curl_exec($curl);
$r=json::from_j($result);
curl_close($curl);
print_r($r['data']);
?>