I'm trying to use the REST API of a telecommunications company to return an access token using curl, here is my code:
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.touch.technology/auth/token",
CURLOPT_POST=> true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=*********&client_secret=*********",
"content-type: x-www-form-urlencoded",
]);
$data = curl_exec($curl);
curl_close($curl);
var_dump($data);
?>
Yet all i recive is "string(12) "Unauthorized""
Can anybody tell me where im going wrong?
"content-type: x-www-form-urlencoded"isn't a valid setopt option.