Jump to content

cURL download google docs


fry2010

Recommended Posts

Ok, my issue is that when using cURL to download a request to google docs, using cURL option file transfer, it downloads immediately. This means that all I really end up saving is a loading screen.

 

So I guess my question is, is there a way to make cURL wait untill the page at google docs is complete? Or is there a better solution? I basically want to store a local copy of what google docs produces, so next time a user needs to view that document, they dont have to wait for loading time.

 

Here is curl request im using:

 

            // Download the file from google docs
    $fh = fopen(DIR_DOWNLOAD . '/database/' . $fileName . '.html', 'w');
    $ch = curl_init($docsFile);
    curl_setopt($ch, CURLOPT_FILE, $fh);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_exec($ch);
    print_r(curl_getinfo($ch));
    curl_close($ch);
    fclose($fh);

 

Link to comment
Share on other sites

mmk, I failed to spot that looking at google docs, rather than their API. Will have look through that, thanks. btw if any of you know of the method I should use that would be handy, otherwise Ill have a good look through. cheers.

Link to comment
Share on other sites

Can someone advise, the way I need to use the API is basically like this:

 

I will be setting a cron job to send a bunch of documents to google docs to parse them

 

I then want to retrieve the documents that google has parsed into images, i imagine using the download document method in the API.

 

However, googles documentation on obtaining an OAUTH token falls short here. Can someone point me to an example of requesting an OAUTH token to my own account? If I even need that?

 

I have the access key etc, but knowwhere does it explain how I actually permit myself access, at least I cant find it.

Link to comment
Share on other sites

Ok I don't think what I want to do is possible with google API docs. Basically I want to display .doc, .docx etc files in the browser, with all the same formatting. So googles API doesnt have anything for the viewer from what I can tell.

Link to comment
Share on other sites

https://docs.google.com/viewer

 

You realise google have their own format for documents? It's not a simple .doc format. I was at a google event in London recently where they explained all their future plans etc and how they want to hold everyone's documents in a central location.

yeah, and not just their documents either....muhahahaha!

Link to comment
Share on other sites

It wouldn't surprise me but they were reluctant to discuss anything other then their docs at this particular event. I did question however, what would happen if - in the very unlikely and possibly impossible - google crashed and burned. Every-bodies documents would go  :psychic:

Link to comment
Share on other sites

I'd be more concerned with the more plausable "what happens to the information if Google sells out to or merges with A. N Other company"?  what protection do users have against said company accessing and using documentation that is stored on googles servers? 

 

anyway, hijack incident over I think, everyone can go back to their normal routine, move along, nothing to see here....

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.