How to upload a file with google drive api?

Send a request to receive a url for downloading a file through the files
https://www.googleapis.com/drive/v2/files/id file?mimeType=application/vnd.google-apps.file

Then get the answer with the available url, I need to download these 2.
"thumbnailLink": "https://docs.google.com/feeds/vt?gd=true&id=1dIkPnfPQ8cJ4VLRdj9H1ppQT_XTaf6vUfqa6Rpcurco&v=2&s=AMedNnoAAAAAWdtTpTjrftgIbUevyF_gxbA-GZfTI0w4&sz=s220"


"https://docs.google.com/feeds/download/documents/export/Export?id=1dIkPnfPQ8cJ4VLRdj9H1ppQT_XTaf6vUfqa6Rpcurco&exportFormat=docx


Tried this but instead of the docs file I get the layout of the page
$url = 'https://docs.google.com/feeds/download/documents/export/Export?id=1dIkPnfPQ8cJ4VLRdj9H1ppQT_XTaf6vUfqa6Rpcurco&exportFormat=docx';
 $content = file_get_contents($url);
 $fp = fopen(ROOT.'public/imasge.docx', 'w');
fwrite($fp, $content);
fclose($fp);

How to upload a file to a folder?
June 14th 19 at 18:22
1 answer
June 14th 19 at 18:24
Solution

Find more questions by tags APIGoogleGoogle DrivePHP