gpt4 book ai didi

php - CURL函数在php中返回null

转载 作者:行者123 更新时间:2023-12-05 03:14:10 25 4
gpt4 key购买 nike

我正在尝试从我的 zendesk 帐户中获取一些数据,如下所示:

$ch = curl_init();
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10 );
curl_setopt($ch, CURLOPT_URL, "https://testing136.zendesk.com/api/v2/users/me.json");
curl_setopt($ch, CURLOPT_USERPWD, "mymail@gmail.com/token:apikey");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$output = curl_exec($ch);
curl_close($ch);
$decoded = json_decode($output);
print("Decode ".$decoded);

我仔细检查了参数和数据,但没有返回任何内容。尽管我尝试在 cmd 中 curl 并且成功完成,但我只是得到 Null。

非常感谢任何帮助。

最佳答案

请补充

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

关于php - CURL函数在php中返回null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26526072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com