[英]How to get list of files and folders from Google Drive on my own website using PHP?
I have a case where i need to display user's google drive data on my own website. 我有一个案例,我需要在我自己的网站上显示用户的谷歌驱动器数据。 how to do this. 这个怎么做。 i have setup Google's Example DriRdit. 我已经设置了Google的DriRdit示例。
The first step is authentication. 第一步是身份验证。 You can use Google's own example detailed here which runs you through the entire procedure of doing that. 您可以使用此处详细介绍的Google自己的示例,该示例将指导您完成此操作的整个过程。
Once you have authentication complete, you can do the following: Register for an API key here . 完成身份验证后,您可以执行以下操作: 在此处注册API密钥。
You can now send an HTTP GET request using cURL or file_get_contents() in PHP to the URL https://developers.google.com/drive/v2/files/list
. 您现在可以使用PHP中的cURL或file_get_contents()将HTTP GET请求发送到URL https://developers.google.com/drive/v2/files/list
。 An AJAX request to the page wouldn't work as the page wouldn't be a part of your domain. 对页面的AJAX请求不起作用,因为页面不是您域的一部分。 You need to send your requests with the following parameters. 您需要使用以下参数发送请求。
maxResults integer Maximum number of files to return. maxResults integer要返回的最大文件数。
pageToken string Page token for files. pageToken string文件的页面标记。
q string Query string for searching files. q string搜索文件的查询字符串。
The final request might look like 最终的请求可能看起来像
file_get_contents("https://developers.google.com/drive/v2/files/list?maxResults=".$maxResults."&pageToken=".$pageToken");
Link: Documentation 链接: 文档
我建议你访问这些链接: php zend gdata - 使用oauth获取谷 歌文档列表和使用谷歌文档列表数据API(Zend)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.