Отсылаю запрос на свой сервер вот с такими параметрами
<?php
$queryUrl = '';
$queryData = json_encode(
array(
"data_about_deal" => [
"name" => 'Dima',
"email" => "BrepeX2@gmail.com"
],
"utm" => [
"content" => 'yandex'
]
)
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTPHEADER,
array(
'Content-Type: application/json',
)
);
curl_setopt_array($curl, array(
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $queryUrl,
CURLOPT_POSTFIELDS => $queryData,
));
$result = curl_exec($curl);
curl_close($curl);
$result = json_decode($result, 1);
echo "Ответ на Ваш запрос: ";
echo '<pre>';
print_r($result);
echo '</pre>';
?>
И выдает вот такую ошибку
Array
(
[message] => Request failed with status code 400
[name] => AxiosError
[stack] => AxiosError: Request failed with status code 400
[config] => Array
(
[transitional] => Array
(
[silentJSONParsing] => 1
[forcedJSONParsing] => 1
[clarifyTimeoutError] =>
)
[transformRequest] => Array
(
[0] =>
)
[transformResponse] => Array
(
[0] =>
)
[timeout] => 0
[xsrfCookieName] => XSRF-TOKEN
[xsrfHeaderName] => X-XSRF-TOKEN
[maxContentLength] => -1
[maxBodyLength] => -1
[env] => Array
(
[Blob] =>
)
[headers] => Array
(
[Accept] => application/json, text/plain, */*
[Content-Type] => application/json
[Authorization] => Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjRmNjUxYTA1MDA3MGRjNjczYmI5MzZhYzU2ODcxY2VjM2E0OTJhZjhjMjljOWY5NWY4NTMxNjdiNTZjOGY2MTY0Nzg3NzZjM2U3ZmU4Yjc1In0.eyJhdWQiOiIwZjk1ZDUxOC1lNmVhLTQ2YzYASFAFSAfasftOTZmZS04Zjk4ODBhMWY0NjgiLCJqdGkiOiI0ZjY1MWEwNTAwNzBkYzY3M2JiOTM2afasfafYWM1Njg3MWNlYzNhNDasfFASFAfafkyYWY4YzI5YzlmOTVmODUzMTY3YjU2YzhmNjE2NDc4Nzc2YzNlN2ZlOGI3NSIsImlhdCI6MTY2OTE5MzA0OCwibmJmIjoxNjY5MTkzMDQ4LCJleHAiOjE2NjkyNzk0NDgsInN1YiI6IjgyNzk5MDIiLCJhY2NvdW50X2lkIjozMDIyNjM0NSwiYmFzZV9kb21haW4iOiJhbW9jcm0ucnUiLCJzY29wZXMiOlsicHVzaF9ub3RpZmljYXRpb25zIiwiZmlsZXMiLCJjcm0iLCJmaWxlc19kZWxldFSAFAfasfAFGUiLCJub3RpZmljYXRpb25zIl19.R9czrO9oYPrkaoHz3HIoGyX9ONL1U1mhVGd_FWU8FYAZs70_koX0AY0NnWUHtqAOD8xC48lRxNq9wI3PKOep5e8Er3F-Eik6P_JTjBnxSvPc9PsV2r_Nl3k2jjg7VzW6FBlQOdnJi9IpP2DCRMCca36l58ZJhPiAgByOfNrPY4A9p7eZyE-Uqap9yNBtOgl4_HFbp8qZ3Zl8LOmHWSCQQDG3Ilt6jYI2jkCsjFp4-i6Dqcu2R1tFJ5TQdr1SJS6m4bqhOEQHnOBmr2t4VVjXgcK0guXRbfa7GsYNawgJGQvIDxY6YaLUvUKqsIW1apowsUabKeUtBZrtGWSDnGvdtQ
[User-Agent] => axios/1.1.3
[Content-Length] => 569
[Accept-Encoding] => gzip, deflate, br
)
[url] => https://testing.amocrm.ru/api/v4/leads/complex
[method] => post
[data] => [{"name":"Заявка с сайта","price":"","custom_fields_values":[{"field_id":728063,"values":[{"value":"yandex"}]},{"field_id":728065,"values":[{"value":""}]},{"field_id":728067,"values":[{"value":""}]},{"field_id":728069,"values":[{"value":""}]},{"field_id":728071,"values":[{"value":""}]},{"field_id":1019367,"values":[{"value":""}]}],"_embedded":{"contacts":[{"first_name":"Dima","custom_fields_values":[{"field_code":"EMAIL","values":[{"enum_code":"WORK","value":"BrepeX2@gmail.com"}]},{"field_code":"PHONE","values":[{"enum_code":"WORK","value":""}]}]}]}}]
)
[code] => ERR_BAD_REQUEST
[status] => 400
)
А когда делаю запрос с postman, все работает, в чем может быть проблема?