KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I followed again THIS TUTORIAL to upload a file on Google Drive with php, directly from my REMOTE SERVER: so I have created new API Project from Google API Console, enabled Drive API service, requested OAuth Client ID and Client Secret, wrote them in a script, then upload it together with Google APIs Client Library for PHP folder to this http://www.MYSERVER.com/script1.php , to retrieve Auth code: <?php require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google_DriveService.php'; $drive = new Google_Client(); $drive->setClientId('XXX'); // HERE I WRITE MY Client ID $drive->setClientSecret('XXX'); // HERE I WRITE MY Client Secret $drive->setRedirectUri('urn:ietf:wg:oauth:2.0:oob'); $drive->setScopes(array('https://www.googleapis.com/auth/drive')); $gdrive = new Google_DriveService($drive); $url = $drive->createAuthUrl(); $authorizationCode = trim(fgets(STDIN)); $token = $drive->authenticate($authorizationCode); ?> When I visit http://www.MYSERVER.com/script1.php I allow authorization and get the Auth code that I can write in a second script. Then I upload it to http://www.MYSERVER.com/script2.php , who looks like: <?php require_once 'google-api-php-client/src/Google_Client.php'; require_once 'google-api-php-client/src/contrib/Google_DriveService.php'; $drive = new Google_Client(); $drive->setClientId('X'); // HERE I WRITE MY Client ID $drive->setClientSecret('X'); // HERE I WRITE MY Client Secret $drive->setRedirectUri('urn:i
Tags (comma-separated)
Save Edits
Cancel