Hi,

I would recommend checking out this thread:

http://groups.google.com/group/Google-Docs-Data-APIs/browse_thread/thread/787d124bbddfabe0#

Cheers,
- Jochen


On Oct 18, 7:30 pm, HippoMan <[EMAIL PROTECTED]> wrote:
> I found another, better way to do this (refer to my code above):
>
> // ... etc. ...
> $query = new Zend_Gdata_Spreadsheets_DocumentQuery();
> $query->setDocumentType('spreadsheets');
> try {
>     $feed = $ssService->getSpreadsheetFeed($query);}
>
> catch (Exception $e) {
>   echo "<pre>\n";
>   print_r($e);
>   echo "</pre>\n";
>   exit(0);}
>
> // ... etc. ...
>
> In other words, we create a Zend_Gdata_Spreadsheets_DocumentQuery
> object and we set its document type to 'spreadsheets'.  Then, we pass
> this query object as an argument to the getSpreadsheetFeed method.
> This causes it to automatically modify the URI that it uses internally
> into the same form that I explicitly coded in my previous message.
>
> So it appears that the Zend Gdata API indeed has a way to manage the
> setting of this URI without the programmer having to explicitly set
> it, and without having to hack the underlying code.
>
> Note that we have to be careful not to reuse this query object "as is"
> if we're subsequently calling getSpreadsheetKey, because the document
> type cannot be set to 'spreadsheets' when that method is being called.
> If we reuse that object, we have to do this before calling
> getSpreadsheetsKey ...
>
> $query->setDocumentType('');
>
> This begs a new question: is any of this documented? I couldn't find
> any docs which describe how to use the methods of the
> Zend_Gdata_Spreadsheets_DocumentQuery in order to solve this kind of
> problem, and I had to figure it out by looking through the source code
> for the Zend/Gdata package. This apparent lack of docs caused me to
> waste quite a few hours, and I would guess that this loss of person-
> hours has been multiplied many times over by others who have to solve
> the same problems.
>
> It's good that we have these forums where we can share our knowledge,
> but I believe that its incumbent upon the developers/releasers of Zend/
> Gdata to provide more detailed documentation about the structure of
> the objects they release and their use in these common tasks. Sample
> code is provided and it's helpful, but it isn't enough without proper
> documentation.
>
> ... or have I simply missed a discussion of this somewhere in the
> official docs?
>
> On Oct 18, 12:49 am, HippoMan <[EMAIL PROTECTED]> wrote:
>
> > Well, I found a solution:
>
> >http://groups.google.com/group/Google-Docs-Data-APIs/browse_thread/th...
>
> > I have to pass the following argument to getSpreadsheetFeed():
>
> > 'http://spreadsheets.google.com/feeds/spreadsheets/private/full'
>
> > In other words ...
>
> > $feed = $ssService->getSpreadsheetFeed('http://spreadsheets.google.com/
> > feeds/spreadsheets/private/full');
>
> > This is necessary because the default URI used within the
> > Zend_Gdata_Spreadsheets class isn't correct ... at least not for the
> > way I'm using it here.  The default is 'http://spreadsheets.google.com/
> > feeds/spreadsheets'.
>
> > Does that default work for certain kinds of spreadsheets, or is it no
> > longer valid at all? If it's the latter, then the ZendGdata code needs
> > to be changed.
>
> > It turns out that the gdata.py API uses a URI of the form
> > http://{X}/feeds/spreadsheets/{Y}/{Z} where {X} defaults to
> > 'spreadsheets.google.com', {Y} defaults to 'private', and {Z} defaults
> > to 'full', and where {X}, {Y}, and {Z} are overridable at run time.
> > Methinks that the ZendGdata API should use the same defaults.
>
> > On Oct 17, 10:39 pm, HippoMan <[EMAIL PROTECTED]> wrote:
>
> > > I'm trying to use the Zend Gdata API to retrieve data from some Google
> > > spreadsheets, and I'm following the pattern described in this
> > > document:http://framework.zend.com/manual/en/zend.gdata.spreadsheets.html.
> > > However, when I issue the getSpreadsheetFeed() method as described in
> > > that document, my application throws an exception.
>
> > > Here's my code (email and password changed to dummy values):
>
> > > $email = '[EMAIL PROTECTED]';
> > > $pw    = 'my-password';
> > > $service = Zend_Gdata_Spreadsheets::AUTH_SERVICE_NAME;
> > > try {
> > >  $client = Zend_Gdata_ClientLogin::getHttpClient($email, $pw,
> > > $service);}
>
> > > catch (Zend_Gdata_App_CaptchaRequiredException $cre) {
> > >   echo 'URL of CAPTCHA image: ' . $cre->getCaptchaUrl() . "<br/>\n";
> > >   echo 'Token ID: ' . $cre->getCaptchaToken() . "<br/>\n";
> > >   exit(0);}
>
> > > catch (Zend_Gdata_App_AuthException $ae) {
> > >   echo 'Problem authenticating: ' . $ae->exception() . "<br/>\n";
> > >   exit(0);}
>
> > > echo "Authenticated<br/>\n";
> > > $ssService = new Zend_Gdata_Spreadsheets($client);
> > > echo "ssService created<br/>\n";
> > > $feed = $ssService->getSpreadsheetFeed();
> > > echo "feed created<br/>\n"
> > > foreach ($feed->entries as $entry) {
> > >   echo $entry->title->text .' '. $entry->content->text . "<br/>\n";
>
> > > }
>
> > > The exception gets thrown right at the getSpreadsheetFeed() method
> > > call. Here are the first few lines:
>
> > > An error occurred
> > > Application error
> > > Exception information:
>
> > > Message: Expected response code 200, got 404
> > > Not Found
> > > Error 404
>
> > > Stack trace:
>
> > > #0 /home/ofrecord/sites/hotelp/library/Zend/Gdata.php(201):
> > > Zend_Gdata_App->performHttpRequest('GET', 'http://spreadsh...', Array,
> > > NULL, NULL, NULL)
> > > #1 /home/ofrecord/sites/hotelp/library/Zend/Gdata/App.php(610):
> > > Zend_Gdata->performHttpRequest('GET', 'http://spreadsh...')
> > > #2 /home/ofrecord/sites/hotelp/library/Zend/Gdata/App.php(541):
> > > Zend_Gdata_App->get('http://spreadsh...')
> > > #3 /home/ofrecord/sites/hotelp/library/Zend/Gdata/App.php(147):
> > > Zend_Gdata_App->importUrl('http://spreadsh...', 'Zend_Gdata_Spre...')
> > > #4 /home/ofrecord/sites/hotelp/library/Zend/Gdata.php(148):
> > > Zend_Gdata_App->getFeed('http://spreadsh...', 'Zend_Gdata_Spre...')
> > > #5 /home/ofrecord/sites/hotelp/library/Zend/Gdata/
> > > Spreadsheets.php(139): Zend_Gdata->getFeed('http://spreadsh...',
> > > 'Zend_Gdata_Spre...')
> > > #6 /home/ofrecord/sites/hotelp/application/views/scripts/index/
> > > index.phtml(27): Zend_Gdata_Spreadsheets->getSpreadsheetFeed()
> > > ... etc. ...
>
> > > The email address and password are correct. Furthermore, making the
> > > corresponding calls through the gdata.py API works without a problem.
>
> > > Can anyone tell me what I'm doing wrong when using this Zend API?
>
> > > Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to