$ArrayToSend = [
'api_key' => 'API key',
'url' => 'Посилання на яку буде зроблено редирект (https://site/)',
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://root-i.work/t/api',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($ArrayToSend),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"cache-control: no-cache"
],
]);
$response = curl_exec($curl);
curl_close($curl);
array(3) [
["success"]=>
string(4) "true"
["key"]=>
string(12) "wrb1solnz5xt"
["full_url"]=>
string(34) "https://root-i.work/t/wrb1solnz5xt"
]
array(2) [
["message"]=>
string(46) "Причина помилки"
["success"]=>
string(5) "false"
]