[英]How to access google photos using api in php?
I want to fetch all the photos on Google photos on my web site using php.我想使用 php 获取我网站上 Google 照片上的所有照片。 Is it possible?.
有可能吗? I know Picasa Web Albums Data API deprecated.
我知道 Picasa 网络相册数据 API 已弃用。 I have got try it from Picasa.
我已经从 Picasa 尝试过了。 but i am not able to download library from https://developers.google.com/gdata/articles/php_client_lib .
但我无法从https://developers.google.com/gdata/articles/php_client_lib下载库。
There is currently no Google Photos API.目前没有 Google 相册 API。 The only thing available is Picasa.
唯一可用的是 Picasa。 You may be able to upload the pictures to your google drive account and display them on your website that way.
您可以将图片上传到您的 Google Drive 帐户并以这种方式显示在您的网站上。 However your probably going to have to set the pictures to public.
但是,您可能必须将图片设置为公开。
There is an API now for Google photo's.现在有一个用于 Google 照片的 API。 But I've not been successfull in making it work myself
但我没有成功地让它自己工作
https://developers.google.com/photos/ https://developers.google.com/photos/
I am trying to do the same thing, so far, I setup the 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);
The autoload
and base.php
files were copied from the mentioned link. autoload
和base.php
文件是从提到的链接复制的。 I copied my api to a file .apiKey
.我将我的 api 复制到一个文件
.apiKey
。 Up to this point, the code works fine, the example in the previous link explains how to create a new google service for e-books.到目前为止,代码运行良好,上一个链接中的示例解释了如何为电子书创建新的谷歌服务。 There must be a similar thing for google photos but couldn't find any yet.
谷歌照片一定有类似的东西,但还没有找到。
I found the following but I am not getting anything with the echo :我发现了以下内容,但我没有得到任何与 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.