如何在 PHP 中访问 Google 电子表格 API? [英] How do I access the Google Spreadsheets API in PHP?

查看:55
本文介绍了如何在 PHP 中访问 Google 电子表格 API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从 Google Developer Google Spreadsheets API 上的文档开始,我发现许多客户端库以各种语言提供.",但 Google 仅提供 Java 和 .NET 的客户端库.对于 PHP 库,他们推荐使用 Zend GData.因此,我查看了 Zend GData 存储库,Zend 说他们的 GData 组件已停产,并且使用 适用于 PHP 的 Google API 客户端库.该库不适用于电子表格 API,因此您必须返回到我开始使用的原始页面.

Starting with the Google Developer documentation on the Google Spreadsheets API, I found that "A number of client libraries are provided in various languages.", but Google only provides client libraries for Java and .NET. For a PHP library, they recommend using Zend GData. So, I headed over the the Zend GData repo, and Zend says that their GData component is discontinued, and to use Google APIs Client Library for PHP. That library doesn't work with the Spreadsheets API, for that you have to go back to the original page that I started with.

所以,似乎每个人都在推卸责任.我只需要编写一些 PHP 代码来请求和处理来自 Google 电子表格的数据.我怎么做?请不要在没有检查以确保它们是 100% 最新的情况下将我链接到类似的帖子或页面,我几个小时以来一直在筛选一大堆帖子,这些帖子都充满了过时和弃用的依赖项.

So, it seems like everyone's passing the buck. I just need to write some PHP code that requests and processes data from a Google Spreadsheet. How do I do that? Please don't link me to similar posts or pages without checking to be sure that they are 100% up to date, I've been sifting through a huge mess of posts for hours that are all full of outdated and deprecated dependencies.

推荐答案

您可以使用 PHP Google 电子表格客户端库.

您需要使用 PHP 的 Google API 客户端库 作为以及通过 OAuth2 进行身份验证.开发者文档链接在 github 页面上.

You'll need to use the Google APIs Client Library for PHP as well to authenticate via OAuth2. Developer documentation is linked on the github page.

这篇关于如何在 PHP 中访问 Google 电子表格 API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆