This is a simple demo script that allows you upload file into required google drive folder, creating all parent folders in the way, if required.
Or download file from specified path on your google drive.
Install dependencies via composer:
php composer.phar install
Follow the steps in config.php to create client_secret.json for you google drive project. Download it and put in credentials folder.
Run index.php via command-line or in browser.
On first run, script will ask you to authorize access to your google drive account. Paste the code, script will create google_drive.token.json in credentials. This token will be used to access your google drive for all subsequent runs. Token doesn't expire, unless not used for 6 months. Make sure script have write access to credentials folder.
On success, index.php will upload image.jpg into file '/images/nature/mountains/river.jpg' on your google drive, and download it back as local river-new.jpg
Upload file:
$link = upload_file_gd('/images/nature/mountains', 'image.jpg', 'river.jpg');
Download file:
download_file_gd('/images/nature/mountains/river.jpg', 'local-river.jpg');
I don't have windows to check that and provide patch/instructions, but they told me that this articles helped them solve the problem.
https://superuser.com/questions/442793/why-cant-curl-properly-verify-a-certificate-on-windows https://stackoverflow.com/questions/21114371/php-curl-error-code-60