почему в Postman работает и получает успешный результат, а при копировании готового кода curl на сайт , который этот Postman сам генерит, не работает?
вот код который выдает Postman
<?php
error_reporting(E_ALL);
$curl = curl_init();
assert(curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.sbis.ru/retail/sale/create",
CURLOPT_AUTOREFERER => true,
CURLOPT_BINARYTRANSFER => true,
CURLOPT_COOKIESESSION => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_FORBID_REUSE => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 11,
CURLOPT_ENCODING=>"",
CURLOPT_USERAGENT=> $_SERVER["HTTP_USER_AGENT"],
CURLOPT_MAXREDIRS => 10,
CURLOPT_COOKIE => 'sid=СЮДАКУКИ',
CURLOPT_POST=>true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array ("companyID" => "СВОЕcompanyID",
"cashierFIO"=> "ФИОКАССИРА", "operationType"=> "1", "cashSum"=> "100", "bankSum"=> null, "internetSum"=> null, "accountSum"=> null, "postpaySum"=> null, "prepaySum"=> null, "vatNone"=> "100", "vatSum0"=> null, "vatSum10"=> null, "vatSum20"=> null, "vatSum110"=> null, "vatSum120"=> null, "allowRetailPayed"=> "1", "nomenclatures"=> array ( "nameNomenclature"=> "Товар для животных в ассортименте", "barcodeNomenclature"=> "95211", "priceNomenclature"=> "100", "quantityNomenclature"=> "1", "measureNomenclature"=> "ШТ", "kindNomenclature"=> "Т", "totalPriceNomenclature"=> "100", "taxRateNomenclature"=> "0", "totalVat"=> "100" ), "customerFIO"=> null, "customerEmail"=> null, "customerPhone"=> null, "customerINN"=> null, "customerExtId"=> null, "taxSystem"=> "8", "sendEmail"=> "test@test.ru", "sendPhone"=> null, "propName"=> null, "propVal"=> null, "comment"=> "тестовый чек", "payMethod"=> "4"),
CURLOPT_HTTPHEADER => array("Content-Type: application/json; charset=utf-8",
"X-SBISAccessToken: ТОКЕНСЮДАВПИШИТЕ\r\n"."Content-Length: 67\r\n"."Content-Disposition: inline; filename*=UTF-8\r\n"
),
)));
$response = curl_exec($curl);
print_r(curl_getinfo($curl));<code lang="php">
//echo $curl;
curl_close($curl);
</code>
вот ответ
curl info
Array ( [url] => https://api.sbis.ru/retail/sale/create [content_type] => application/json; charset=utf-8 [http_code] => 500 [header_size] => 780 [request_size] => 632 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.441873 [namelookup_time] => 0.028462 [connect_time] => 0.046011 [pretransfer_time] => 0.209743 [size_upload] => 0 [size_download] => 690 [speed_download] => 1561 [speed_upload] => 0 [download_content_length] => 690 [upload_content_length] => 2965 [starttransfer_time] => 0.441774 [redirect_time] => 0 [certinfo] => Array ( ) [redirect_url] => )