在PHP中的日历API错误(calendy API error in php)

编程入门 行业动态 更新时间:2024-10-27 18:31:34
在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);

更多推荐

本文发布于:2023-07-26 02:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269969.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日历   错误   API   PHP   error

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!