我正在尝试从我的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);
我已经仔细检查了参数和数据,但没有返回任何内容。我只是得到Null,虽然我试图在cmd中卷曲并且它已成功完成。
任何帮助都会非常感激。
答案 0 :(得分:3)
请添加
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
答案 1 :(得分:0)
//只需删除行号。 Codeigniter中的267个application / libraries / REST_Controller.php
header('Content-Length: ' . strlen($output));