"_embedded" => [
'tags' => [
['name' => $tag],
],
],
array(2) { ["content"]=> NULL ["status_code"]=> int(402) } array(2) { ["content"]=> array(4) { ["title"]=> string(9) "Not Found" ["type"]=> string(25) "https://httpstatus.es/404" ["status"]=> int(404) ["detail"]=> string(53) "Cannot POST https://subdomain.amocrm.ru/leads//notes!" } ["status_code"]=> int(404) }
$method = "/api/v4/leads/complex";
$headers = [
'Content-Type: application/json',
'Authorization: Bearer ' . $access_token,
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_USERAGENT, 'amoCRM-API-client/1.0');
curl_setopt($curl, CURLOPT_URL, "https://$subdomain.amocrm.ru".$method);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_COOKIEFILE, 'amo/cookie.txt');
curl_setopt($curl, CURLOPT_COOKIEJAR, 'amo/cookie.txt');
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
$out = curl_exec($curl);
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
$code = (int) $code;
$errors = [
301 => 'Moved permanently.',
400 => 'Wrong structure of the array of transmitted data, or invalid identifiers of custom fields.',
401 => 'Not Authorized. There is no account information on the server. You need to make a request to another server on the transmitted IP.',
403 => 'The account is blocked, for repeatedly exceeding the number of requests per second.',
404 => 'Not found.',
500 => 'Internal server error.',
502 => 'Bad gateway.',
503 => 'Service unavailable.'
];
if ($code < 200 || $code > 204) die( "Error $code. " . (isset($errors[$code]) ? $errors[$code] : 'Undefined error') );
$Response = json_decode($out, true);
$Response = $Response['_embedded']['items'];
$output = 'ID добавленных элементов списков:' . PHP_EOL;
foreach ($Response as $v)
if (is_array($v))
$output .= $v['id'] . PHP_EOL;
return $output;
dots: true,
customPaging: function(slick,index) {
var targetImage = slick.$slides.get(index).find('img').attr('src') || '';
return '<img src=" ' + targetImage + ' "/>';
}