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 a Moved Temporarily message. 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 -~----------~----~----~----~------~----~------~--~---