���� 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/hls4.vidoe.top/ |
<?php 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-g5_GPGYeAcLnbNmguML0Mz9pDd-PlzcQpXad8Cb8p9DX_OqwtwFmpJYwm8uxqkoKg'; // 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('store/2020/11/08/playlist_17656.1.mp4-5fa7fa4ff2a7d-1604844111_0.ts'); $data = 'qdqwdqwd'; $createdFile = $service->files->create($file, array( 'data' => $data, 'mimeType' => 'application/octet-stream', 'uploadType' => 'multipart' )); $id_return = $createdFile->id; echo $id_return; exit(); ?>