我将这个URL用于API文档https://dev.bitly.com/v4_documentation.html
我的代码是:
//short URL is bit.ly/2WoKAKu
$url = 'https://api-ssl.bitly.com/v4/bitlinks/2WoKAKu/clicks';
$token = 'my-token';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_GETFIELDS, json_encode(['unit'=>'day','units'=>-1]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer ".$token,
"Content-Type: application/json"
]);
$arr_result = json_decode(curl_exec($ch));
但是收到此错误:
stdClass Object
(
[message] => FORBIDDEN
)