我正在尝试在 php 中使用 calendy API 我使用以下代码来检查身份验证令牌
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://calendly.com/api/v1/echo");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"X-TOKEN: <Token-code>",// My Token code here
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch , CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch , CURLOPT_POST, true);
curl_setopt($ch , CURLOPT_POSTFIELDS, $curl_post_data);
curl_setopt($ch , CURLOPT_SSL_VERIFYPEER, false); //IMP if the url has https and you don't want to verify source certificate
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
print_r($result);?>
但我收到错误消息 404 未经授权
{
"type": "authentication_error",
"message": "Invalid token"
}