S
Size: a a a
S
Н
M
// 1. Не рабочий вариант с газлом
$client = new Client([
'headers' => [
'Content-Type' => 'application/json',
'SECURE-AUTH' => \config('settings.SECURE_TOKEN')
]
]);
$response = $client->post('https://website.com/api/secure/code-check',
['body' => json_encode(
[
'code' => $code
]
)]
);
// 2. Рабочий вариант с курлом
$data_string = json_encode(["code" => $code]);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://website.com/api/secure/code-check");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$headers = [
'Content-Type: application/json',
'SECURE-AUTH: ' . \config('settings.B2B_SECURE_TOKEN')
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
POST https://website.com/api/secure/code-check
resulted in a 400 Bad Request
S
Р
ИЛ
Н
Р
S
ИЛ
ИЛ
ИЛ
Н
ИЛ
S
S
S
ИЛ
S