带有PHP的Google Spreadsheet API [英] Google Spreadsheet API with PHP

查看:69
本文介绍了带有PHP的Google Spreadsheet API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Google电子表格API读取和写入Google电子表格, 经过漫长的战斗,我能够获取访问令牌并将其存储在会话变量中,但我不知道如何交换此令牌以从电子表格中获取内容并更新电子表格.

I want to read from and write to Google spreadsheet using google spreadsheet API, After long battle I was able to get access token and stored it in a session variable, but i don't understand how to exchange this token to get contents from spreadsheet and to update spreadsheet.

我正在尝试使用以下代码来获取单元格内容.但是什么也没有退回.

I was trying with below code to get a cell content. But nothing is being returned.

<?php
session_start();
$url =  'https://spreadsheets.google.com/feeds/cells/0AgxnPrGJ8****************RkMwSkZoQ2pXaFE/4/private/full/R2C2';

$headers = array(
                'Authorization' => 'Bearer '.$_SESSION['access_token'],
                'Gdata-version' => '3.0'                                                                        
            );

$postdata = http_build_query($headers);
$context =
        array("http"=>
        array(
            "method" => "GET",
            "content" => $postdata
             )
             ); 
$context = stream_context_create($context);
$ResultArray = file_get_contents($url, false, $context);
var_dump($ResultArray);
?>

推荐答案

请参见Google Spreadsheets ="nofollow"> http://framework.zend.com/manual/1.12/en/zend.gdata.html (如果您有漫长的战斗").您可以单独使用Zend Framework的组件(无需安装完整的ZF).

See Google Spreadsheets on http://framework.zend.com/manual/1.12/en/zend.gdata.html, if you wan`t have "long battles". Your can using components of Zend Framework separately (without install full ZF).

这篇关于带有PHP的Google Spreadsheet API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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