faninator
Wed, 22 Jul 2009 19:17:25 -0700
Hi Eric, I've been asking you for help on another thread, but now I also got the Moved Temporarily problem when I tried the script above. However my approach is slightly different - I don't keep users email and password and put them into separate arrays for writely and wise as the "step 1" in the above approach; I simply use the token from wise (I changed that from writely - what's the difference between the two?). Let me know what could be a possible problem with my current approach.
Thanks,
Fan
On Jul 9, 4:16 pm, kross <kyle.t.r...@gmail.com> wrote:
> Eric,
>
> Removing the quotes fixed it. Thank you very much! :)
>
> On Jul 8, 2:51 pm, "Eric (Google)" <api.e...@google.com> wrote:
>
> > Hi,
>
> > That looks about right. Are you sure you're
> > passing the correct auth token (i.e. $ssToken
> > contains the ClientLogin auth token that was
> > obtained for 'wise' and not 'writely')?
>
> > I've also had success in the past with
> > removing the quotes around auth="":
>
> > curl_setopt($ch, CURLOPT_HTTPHEADER, array(
> > 'Authorization: GoogleLogin auth=' . $wiseToken
> > ));
>
> > Let me know,
>
> > Eric
>
> > On Jul 3, 12:01 pm, kross <kyle.t.r...@gmail.com> wrote:
>
> > > I am writing a php script (not using the framework) to display
> > > spreadsheets in html format. I wrote a bash script that does this
> > > without problems, but when requesting each spreadsheet with php/curl,
> > > I get aMovedTemporarilymessage. Here are the steps of my script:
>
> > > 1. Put form post data (email, password, service, etc) into seperate
> > > arrays for writely and wise.
> > > 2. Send cURL POST requests to retrieve tokens for writely and wise and
> > > set these to seperate variables.
> > > 3. Send cURL GET request to retrieve list of spreadsheets and write it
> > > to xml file. This is successful.
> > > 4. Parse XML file for spreadsheet ids.
> > > 5. for loop to download each spreadsheet
>
> > > Here is the part that is giving me trouble:
>
> > > if (file_exists($xmlfile)) {
> > > $xml = simplexml_load_file($xmlfile);
> > > foreach ($xml->entry as $entry) {
> > > $thisId = preg_replace("/.*%3A/", "", $entry->id);
> > > $thisTitle = preg_replace("^[ ]^", "_", $entry->title);
> > > $thisFile = $entry->title . ".html";
> > > echo "$thisTitle will be saved as $thisFile<br />";
>
> > > $ch = curl_init();
> > > curl_setopt($ch, CURLOPT_URL, "http://spreadsheets.google.com/
> > > feeds/download/spreadsheets/Export?key=$thisId&exportFormat=html");
> > > curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
> > > $curlheader[0] = sprintf("Authorization: GoogleLogin auth=\"%s
> > > \"", $ssToken);
> > > curl_setopt($ch, CURLOPT_HTTPHEADER, $curlheader);
> > > $output = curl_exec($ch);
> > > $info = curl_getinfo($ch);
> > > curl_close($ch);
> > > echo $output;
>
> > > }} else {
>
> > > exit('Failed to open list.xml.');
>
> > > }
>
> > > The CURLOPT_URL appears to be correct and is passing the correct keys.
> > > I'm not sure what the problem could be. If anyone has some insight as
> > > to whats wrong, it would be greatly appreciated. Thanks!
--~--~---------~--~----~------------~-------~--~----~
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 Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---