我们如何使用 Zend_Gdata 从公共谷歌电子表格读取数据
我已经阅读了这里的例子: http://framework.zend.com/manual/en/zend。 gdata.spreadsheets.html
但这些示例假设要读取的电子表格需要身份验证:
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
$feed = $spreadsheetService->getSpreadsheetFeed();
我要读取的电子表格是公共电子表格,因此我实际上不需要提供任何身份验证,对吗?我需要提供的只是电子表格的网址。
我尝试阅读此处的类描述,但仍然不知道如何完成: http://framework.zend.com/apidoc/core/Zend_Gdata/电子表格/Zend_Gdata_Spreadsheets.html
I have read the examples here:
http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html
But those examples assume the spreadsheet to be read needs authentication:
$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
$feed = $spreadsheetService->getSpreadsheetFeed();
The spreadsheet I am going to read from is a public one, so I don't really need to provide any authentication right? And what I need to provide is just the url of the spreadsheet.
I tried to read the class description here but still have no idea how it can be done:
http://framework.zend.com/apidoc/core/Zend_Gdata/Spreadsheets/Zend_Gdata_Spreadsheets.html
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无需登录即可查看谷歌公共电子表格。如果不使用用户名和密码登录,身份验证意味着什么?您不需要对公共文件进行身份验证。所以上面的问题依然存在。
You CAN see a google public spreadsheet without being logged on. What does authentication mean if not logging on with name and password? You don't need authentication for public documents. So the question above remains.
就我而言,访问任何 Google 电子表格都需要 Google 帐户,即使文档是公开的(您是否尝试在浏览器中访问它而不登录 Google 帐户?)。所以是的,您需要向 Zend_Gdata 提供身份验证凭据。
As far as I'm concerned, access to any Google spreadsheet requires a Google account, even if the document is public (did you try to access it in the browser without being logged in to your Google account?). So yes, you need to provide Zend_Gdata with authentication credentials.