Last active
May 5, 2025 18:32
-
-
Save bxtimur/49d3194080f6a366523bb7e128cf0712 to your computer and use it in GitHub Desktop.
Samson Request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ключ для соединения | |
$key = '6f4cb12fa15962e18c31942a3e4a73f6'; | |
// код товара | |
$code = '110086'; | |
// запрос | |
$curl = curl_init('https://api.samsonopt.ru/v1/sku/' . $code . '/stock/?api_key=' . $key); | |
$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/65.0.3325.181 Safari/537.36'; | |
curl_setopt($curl, CURLOPT_HTTPHEADER, $arHeaderList); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); | |
$result = curl_exec($curl); | |
curl_close($curl); | |
$item = json_decode($result, true); | |
echo "<pre>"; | |
print_r($item); | |
echo "</pre>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment