<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://suppliers-api.wildberries.ru/content/v1/cards/list',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"sort": {
"limit": 1,
"offset": 50,
"searchValue": "",
"sortColumn": "updateAt",
"ascending": false
}
}',
CURLOPT_HTTPHEADER => array(
'Authorization: тут ваш токен',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
$user = "1c_user";
$pass = "1c_pass";
$path = "upload/";
if (!isset($_SERVER['PHP_AUTH_USER']) && !isset($_SERVER["PHP_AUTH_PW"]) && !isset($_REQUEST["type"])) {
header('WWW-Authenticate: Basic realm="1C-Exchange"');
header('HTTP/1.0 401 Unauthorized');
$_SESSION["login"] = false;
die("failure");
}
if (($_SERVER["PHP_AUTH_USER"] == $user && $_SERVER["PHP_AUTH_PW"] == $pass) || $_SESSION["login"]) {
$_SESSION["login"] = true;
if ($_REQUEST["type"] == "catalog") {
switch ($_REQUEST["mode"]):
case "checkauth":
die("success");
break;
case "init":
die("zip=no" . "\r\n" . "file_limit=0");
break;
case "file":
$filename = (strpos($_REQUEST["filename"], ".") == 0) ? substr($_REQUEST["filename"], 1) : $_REQUEST["filename"];
$dirname = dirname($path . $filename);
if (!is_dir($dirname))
mkdir($dirname, 0755, true);
$file = fopen($path . $filename, 'ab') or die("failure");
fwrite($file, file_get_contents('php://input'));
fclose($file);
die("success");
break;
endswitch;
}
if ($_REQUEST["type"] == "sale") {
}
} else {
header('WWW-Authenticate: Basic realm="1C-Exchange"');
header('HTTP/1.0 401 Unauthorized');
$_SESSION["login"] = false;
die("failure");
}
<?php
namespace backend\controllers;
use Yii;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
class SiteController extends Controller
{
public function beforeAction($action)
{
throw new NotFoundHttpException();
}
<button class="basket"
onclick='yaCounterXXXXXX.reachGoal('CART');add(<?=$arResult["ID"]?>,<?=$arResult["PREVIEW_PICTURE"]["SRC"]?>)'>Добавить в корзину</button>