libcURL and Google Docs
===

I'm trying to download a file needed for my application off the internet (as part of installation) so that the first time the app starts up, the needed files get downloaded. For now I'm putting them on Google Drive and making them public, then I'm going to use libcURL to download them. The problem is, I just can't get the data. 

I use the following link: `https://docs.google.com/uc?id=documentID&export=download` and replace `documentID` with the id. When I try connecting to the site though, it keeps giving me a small snippet of HTML code that basically says "Moved Temporarily" and gives me a link to the new URL. When I use the new link in my program, I get no output whatsoever. However, both links work just fine in my web browser, _even_ when I'm not signed in. So Why don't they work in my program? Am I not setting up SSL options correctly, or is Google Drive simply not meant for this kind of thing?

Here's my code:


    #ifdef _WIN32
    #ifndef CURL_GLOBAL_WIN32
    #define CURL_GLOBAL_WIN32
    #endif
    #endif

    #include <curl/curl.h>
    #include <vector>
    #include <iostream>

    typedef unsigned char byte;
    typedef std::vector<byte> byte_stream;

    size_t write_data(char* data, size_t size, size_t nmemb, void* stream);

    size_t write_data(char* data, size_t size, size_t nmemb, void* stream) 
    {
        size_t count = size * nmemb;
        byte_stream* output = (byte_stream*)stream;
        output->clear();
        output->resize(count);
        output->assign(data, data+count);
        return count;
    }

    int main(void)
    {
        CURL *curl;
        CURLcode res;
        
        curl = curl_easy_init();
        if(curl) {
            byte_stream stream;
            // replace "documentId" in the url with the ID of the document
            curl_easy_setopt(curl, CURLOPT_URL, "https://docs.google.com/uc?id=documentId&export=download");
            curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
            curl_easy_setopt(curl, CURLOPT_WRITEDATA, &stream);
            curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
            curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
            res = curl_easy_perform(curl);
            if (res == CURLE_OK) {
                curl_easy_cleanup(curl);
                std::cout << stream.size() << std::endl;
                std::string data(stream.begin(), stream.end());
                std::cout << data << std::endl;
            } else {
                printf("error: %s\n", curl_easy_strerror(res));
            }
        }
        return 0;
    }

Any help would be appreciated.