5

So I am following this and I'm trying to run his first php example. I get the following error:

PHP Warning: require_once(Zend/Http/Header/HeaderValue.php): failed to open stream: No such file or directory in /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Http/Client.php on line 45

I checked and the file is in fact not there. So I added it from the minimial 1.12 download. It then says Zend/Xml/Security.php doesn't exist so i add it.

Now I am getting the following error:

PHP Notice:  Undefined offset: 1 in /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/ClientLogin.php on line 150
PHP Stack trace:
PHP   1. {main}() /opt2/sites/gdataApi/test.php:0
PHP   2. Google_Spreadsheet->__construct() /opt2/sites/gdataApi/test.php:11
PHP   3. Google_Spreadsheet->login()/opt2/sites/gdataApi/Google_Spreadsheet.php:40
PHP   4. Zend_Gdata_ClientLogin::getHttpClient() /opt2/sites/gdataApi/Google_Spreadsheet.php:223
PHP Notice:  Undefined variable: php_errormsg in /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/App.php on line 834
PHP Stack trace:
PHP   1. {main}() /opt2/sites/gdataApi/test.php:0
PHP   2. Google_Spreadsheet->addRow() /opt2/sites/gdataApi/test.php:24
PHP   3. Google_Spreadsheet->getSpreadsheetId() /opt2/sites/gdataApi/Google_Spreadsheet.php:62
PHP   4. Zend_Gdata_Spreadsheets->getSpreadsheetFeed() /opt2/sites/gdataApi/Google_Spreadsheet.php:252
PHP   5. Zend_Gdata->getFeed() /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/Spreadsheets.php:150
PHP   6. Zend_Gdata_App->getFeed() /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata.php:162
PHP   7. Zend_Gdata_App->importUrl() /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/App.php:213
PHP   8. Zend_Gdata_App::importString() /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/App.php:792
PHP Fatal error:  Uncaught exception 'Zend_Gdata_App_Exception' with message 'DOMDocument cannot parse XML: ' in /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/App.php:833
Stack trace:
#0 /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/App.php(792): Zend_Gdata_App::importString('', 'Zend_Gdata_Spre...', NULL, NULL)
#1 /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/App.php(213): Zend_Gdata_App->importUrl('https://spreads...', 'Zend_Gdata_Spre...', NULL)
#2 /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata.php(162): Zend_Gdata_App->getFeed('https://spreads...', 'Zend_Gdata_Spre...')
#3 /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/Spreadsheets.php(150): Zend_Gdata->getFeed('https://spreads...', 'Zend_Gdata_Spre...')
#4 /opt2/sites/gdataApi/Google_Spreadsheet.php(252): Zend_Gdata_Spreadsheets->getSpreadsheetFeed()
#5 /opt2/sites/gdataApi/Google_Spreadsheet.php(62): Google_Spreadsheet->getSpreadsheetId('test spreadshee...')
#6 /opt2/sites/gdataApi/test.php(24): Google_Spreadsheet in /opt2/sites/gdataApi/ZendGdata-1.12.13/library/Zend/Gdata/App.php on line 833

I have a google spreadsheet that I would like to update programatically using php. Can you tell me whats going wrong with this script? Seems like this is an old article. Are there more recent articles I am missing?

Behzad
  • 3,502
  • 4
  • 36
  • 63
Bill Garrison
  • 2,226
  • 3
  • 34
  • 75
  • Adding `ini_set('track_errors', 1);` to the beginning of your script may give more detail to the exception and tell why DOMDocument is failing to parse the data. Can you try adding that to your example and see if the exception contains more info and post back? – drew010 Jun 10 '15 at 18:13
  • I have actually decided not to pursue this since it seems that google api now needs oauth 2 login and this class does not support that. – Bill Garrison Jun 10 '15 at 18:36
  • Id love to see an answer with an alternative – Bill Garrison Jun 10 '15 at 18:36

1 Answers1

3

Download Zend framework minimal version. Then extract archive and copy /library/Zend/Http/Header directory to your GData's /Zend/Http/ directory.

n0m4dz
  • 61
  • 1
  • 4