ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/hls5.vidoe.top/ |
<?php //giangnn10.nhatrang require 'vendor/autoload.php'; function getClient() { $client = new Google_Client(); $client->setApplicationName('Google Drive API PHP Quickstart'); $client->setScopes(Google_Service_Drive::DRIVE); $client->setAuthConfig('credentials.json'); $client->setAccessType('offline'); $client->setPrompt('select_account consent'); // Load previously authorized token from a file, if it exists. // The file token.json stores the user's access and refresh tokens, and is // created automatically when the authorization flow completes for the first // time. $tokenPath = 'token/token.json'; if (file_exists($tokenPath)) { $accessToken = json_decode(file_get_contents($tokenPath), true); $client->setAccessToken($accessToken); } // If there is no previous token or it's expired. if ($client->isAccessTokenExpired()) { // Refresh the token if possible, else fetch a new one. if ($client->getRefreshToken()) { $client->fetchAccessTokenWithRefreshToken($client->getRefreshToken()); } else { // Request authorization from the user. /*$authUrl = $client->createAuthUrl(); printf("Open the following link in your browser:\n%s\n", $authUrl); print 'Enter verification code: '; exit();*/ //$authCode = trim(fgets(STDIN)); $authCode = '4/0AY0e-g6ejfHT7fMykEvgv4h1D0dD63GvFfuPdohUT5-8dV48ISPno11yFzDUqi5Z-Mpo9Q'; // Exchange authorization code for an access token. $accessToken = $client->fetchAccessTokenWithAuthCode($authCode); $client->setAccessToken($accessToken); // Check to see if there was an error. if (array_key_exists('error', $accessToken)) { throw new Exception(join(', ', $accessToken)); } } // Save the token to a file. if (!file_exists(dirname($tokenPath))) { mkdir(dirname($tokenPath), 0777, true); } file_put_contents($tokenPath, json_encode($client->getAccessToken())); } return $client; } $client = getClient(); $service = new Google_Service_Drive($client); $file = new Google_Service_Drive_DriveFile(); $file->setName(uniqid() . '.txt'); $file->setDescription('docs file'); $file->setMimeType('application/octet-stream'); $data = file_get_contents('cache/hls/filename_8c41664b4844798f25a65d613bb6c3d5-5f14503bdf5a7-15951667793.ts'); $createdFile = $service->files->create($file, array( 'data' => $data, 'mimeType' => 'application/octet-stream', 'uploadType' => 'multipart' )); $id_return = $createdFile->id; echo $id_return; exit();