在PHP中的日历API错误(calendy API error in php)
我想在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" }I am trying to used calendy API in the php I used following code to make check the Authentication Token
<?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);?>But I got error message 404 unauthorized
{ "type": "authentication_error", "message": "Invalid token" }最满意答案
任何使用Calendy API的人都可以像这样使用
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://calendly.com/api/v1/echo"); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "X-TOKEN: TOKE-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); echo $result; curl_close ($ch);Any one who used Calendy API can used like this way
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://calendly.com/api/v1/echo"); curl_setopt($ch, CURLOPT_HTTPHEADER, array( "X-TOKEN: TOKE-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); echo $result; curl_close ($ch);更多推荐
发布评论