0
votes

I tried using google docs sample in the Zend Gdata demos and got the following error :

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Expected response code 200, got 403 403.4 SSL required' in F:\PHP_libs\Zend\Gdata\App.php:714 Stack trace: #0 F:\PHP_libs\Zend\Gdata.php(219): Zend_Gdata_App->performHttpRequest('GET', 'http://docs.goo...', Array, NULL, NULL, NULL) #1 F:\PHP_libs\Zend\Gdata\App.php(880): Zend_Gdata->performHttpRequest('GET', 'http://docs.goo...', Array) #2 F:\PHP_libs\Zend\Gdata\App.php(768): Zend_Gdata_App->get('http://docs.goo...', NULL) #3 F:\PHP_libs\Zend\Gdata\App.php(210): Zend_Gdata_App->importUrl('http://docs.goo...', 'Zend_Gdata_Docs...', NULL) #4 F:\PHP_libs\Zend\Gdata.php(162): Zend_Gdata_App->getFeed('http://docs.goo...', 'Zend_Gdata_Docs...') #5 F:\PHP_libs\Zend\Gdata\Docs.php(130): Zend_Gdata->getFeed('http://docs.goo...', 'Zend_Gdata_Docs...') #6 F:\xampp\htdocs\ZendGdata-1.11.12\demos\Zend\Gdata\Docs.php(277): Zend_Gdata_Docs->getDocumentListFeed('http://docs.goo...') #7 F:\xampp\htdocs\ZendGdata-1.11.12\demos\Zend\Gdata\Docs.php(752): retrieveWPD in F:\PHP_libs\Zend\Gdata\App.php on line 714

I am using Zend library for the first time and am unable to figure out how Authorization works here. Please help

2

2 Answers

2
votes

I'm not sure if this is fixed in the latest version of the Zend library but I went and updated this file in my Zend install: library/Zend/Gdata/Docs.php

The constants around line 62 needed to be updated to change the http to https which now look like this in my install:

const DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/documents/private/full';
const DOCUMENTS_FOLDER_FEED_URI = 'https://docs.google.com/feeds/folders/private/full';
const DOCUMENTS_CATEGORY_SCHEMA = 'https://schemas.google.com/g/2005#kind';
const DOCUMENTS_CATEGORY_TERM = 'https://schemas.google.com/docs/2007#folder';

That did the trick.

1
votes

You must use https instead of http if you want to connect to GoogleDocs, which is stated in the error message you are getting: Expected response code 200, got 403 403.4 SSL required. The parts of the message are interpreted like this:

  • Expected response code 200: the called method expect the http response code to be 200
  • got 403: the actual received http code
  • 403.4 SSL required: a short description to the code

Look at List of HTTP status codes to get more information.

The examples from the Zend Framework: Documentation: Using Google Documents List Data API - Zend Framework Manual aren't up-to-date and should be like this:

$feed = $docs->getDocumentListFeed(
    'https://docs.google.com/feeds/documents/private/full/-/document');