1

I would like to read-write specific cells in a Google Spreadsheet, but I'm puzzled by the lot of information on the internet about how to do it. I only have access to shared hosting (which means an FTP access and a control panel), not a virtual server.

In the Google Docs official API page it only has PHP support in version 1, which says its deprecated, and it's already at version 3, so I shouldn't start using that.

On this page: http://code.google.com/apis/gdata/docs/client-libraries.html it says that the PHP client library is

Distributed as part of zend.

while on this page: http://code.google.com/apis/gdata/articles/php_client_lib.html it says

The client library is part of the open-source Zend Framework but can also be downloaded as a standalone version.

My biggest problem is that I have never used Zend and I don't know how to use it or how to install/update its packages. Is it possible to install/update this framework and its packages from a simple shared hosting user? Or I'm stuck with what I find on a particular hosting company's servers?

I've downloaded the latest version from this page: http://framework.zend.com/download/gdata and in its INSTALL file it says:

Zend Framework requires no special installation steps. Simply download the framework, extract it to the folder you would like to keep it in, and add the library directory to your PHP include_path. To use components in the extras library, add the extras/library directory to your PHP include_path, as well. If you would like to use Zend_Tool, simply add bin/zf.bat (for Windows) or bin/zf.sh (for anything else) to your system executable path.

I think include_path means some variable in php.ini, not something what I have access to. Can I just simply download/extract zend to my folder and do include_once() at a start of my code?

Charles
  • 50,943
  • 13
  • 104
  • 142
hyperknot
  • 13,454
  • 24
  • 98
  • 153

2 Answers2

3

You will want to contact your hosting provider to see if they have the Zend framework installed. If they do, ask them for the include path.

If not, you can download the library, unzip it, and upload it to your web root.

The GDATA module is part of the Zend framework.

Let's say you uploaded the framework to a folder called Zend within your web root.

/www/Zend/

You then need to tell php to use that as your include path like so.

set_include_path($_SERVER['DOCUMENT_ROOT'] . '/Zend/');

From there, you can use the autoLoader function to handle loading of classes from there on out, like so...

require_once 'Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();

Then follow the docs for the GDATA library.....

$service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);
$spreadsheetService = new Zend_Gdata_Spreadsheets($client);
damon
  • 1,087
  • 9
  • 12
1

Take a look at this: http://php.net/manual/en/function.set-include-path.php

set_include_path — Sets the include_path configuration option
Pim Reijersen
  • 1,123
  • 9
  • 33
  • Only if necessary ofcourse, include_once() will probably do the job. – Pim Reijersen Apr 19 '11 at 14:10
  • no, a lot of calls in Zend (and the Zend AutoLoader) `require` other files in the form of `require_once "Zend\File.php"`. So unless you include all files by yourself, it's probably easier to set the include path. – Grad van Horck Apr 19 '11 at 14:16
  • But what you say is that I should download the whole Zend framework and extract it somewhere in an FTP folder? What happens when there is a Zend version already installed on the host, and I want to use the one I supply? Will set_include_path have a priority over the installed one? – hyperknot Apr 19 '11 at 16:19
  • The docs state that this component can be used without the zend framework. So I assume that you just upload this component to your webserver and call set_include_path. If you read the documentation of set_include_path you see that it will override the include_path. In the code example on the php doc it shows to use get_include_path and add your path to it when setting the new include_path. You have full control over the include_path. – Pim Reijersen Apr 19 '11 at 18:43