【发布时间】:2015-04-22 13:37:25
【问题描述】:
我正在尝试使用 office 365 REST API 获取 onedrive 驱动器属性,但是当我 var_dump 我的响应时,我得到的响应为假。下面是我的代码。
$file_api = "https://{tenant}-my.sharepoint.com/_api/v1.0/me/drive/files";
$headers = array(
'Content-Type: application/json',
'Authorization: Bearer'.$token, // Always need our auth token!
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $file_api);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
var_dump($result);
谁能告诉我我在这里做错了什么?
我正在引用此链接。
回复是
array (
'url' => 'https://{tenant}-my.sharepoint.com/_api/v1.0/me/drive/files',
'content_type' => NULL,
'http_code' => 0,
'header_size' => 0,
'request_size' => 0,
'filetime' => -1,
'ssl_verify_result' => 0,
'redirect_count' => 0,
'total_time' => 30.749314999999999,
'namelookup_time' => 0.20429800000000001,
'connect_time' => 0.20474100000000001,
'pretransfer_time' => 0,
'size_upload' => 0,
'size_download' => 0,
'speed_download' => 0,
'speed_upload' => 0,
'download_content_length' => -1,
'upload_content_length' => -1,
'starttransfer_time' => 0,
'redirect_time' => 0,
'redirect_url' => '',
'primary_ip' => '104.146.150.43',
'certinfo' =>
array (
),
'primary_port' => 443,
'local_ip' => '192.168.8.46',
'local_port' => 54470,
)
提前致谢
【问题讨论】: