STDIN is a command line instruction and it isn't a direct valid php statement ..
What i did was :
$client = new Google_Client();
// Get your credentials from the console
$client->setClientId('**********************');
$client->setClientSecret('*********');
$client->setRedirectUri('*********');
$client->setScopes(array('https://www.googleapis.com/auth/drive'));
$authUrl = $client->createAuthUrl();
print $authurl
$authCode = ''; // insert the verification code that you get after going to url in $authurl
file_put_contents('token.json', $client->authenticate($authCode));
After executing this much you'll get your authentication info in the json file token.json ... And you can use the following to upload ... :
$service = new Google_DriveService($client);
$client->setAccessToken(file_get_contents('token.json'));
//Insert a file
..... // rest the same
Once you get your json don't run the top codes again ... Just use the token.json everytime to upload/download ....
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…