![](/img/trans.png)
[英](PHP) Using oauth and service accounts to access private Google Photos (Picasa Web) API info
[英]How to access google photos using api in php?
我想使用 php 获取我网站上 Google 照片上的所有照片。 有可能吗? 我知道 Picasa 网络相册数据 API 已弃用。 我已经从 Picasa 尝试过了。 但我无法从https://developers.google.com/gdata/articles/php_client_lib下载库。
目前没有 Google 相册 API。 唯一可用的是 Picasa。 您可以将图片上传到您的 Google Drive 帐户并以这种方式显示在您的网站上。 但是,您可能必须将图片设置为公开。
现在有一个用于 Google 照片的 API。 但我没有成功地让它自己工作
我正在尝试做同样的事情,到目前为止,我设置了 api:
include_once __DIR__ . '/vendor/autoload.php';
include_once 'base.php';
# create client
$client = new Google_Client();
$client -> setApplicationName("Client_Library_examples");
if(!$apiKey = getApiKey()) {
echo missingApiKeyWarning();
}
$client -> setDeveloperKey($apiKey);
autoload
和base.php
文件是从提到的链接复制的。 我将我的 api 复制到一个文件.apiKey
。 到目前为止,代码运行良好,上一个链接中的示例解释了如何为电子书创建新的谷歌服务。 谷歌照片一定有类似的东西,但还没有找到。
我发现了以下内容,但我没有得到任何与 echo 相关的信息:
$response = file_get_contents('https://photoslibrary.googleapis.com/v1/albums');
$response = json_decode($response);
echo $response
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.