uawdijnntqw1x1x1
IP : 216.73.216.177
Hostname : xhost1.intravision.ru
Kernel : Linux xhost1.intravision.ru 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
files
/
need-2-delete
/
.
/
mini-borishof.ru1
/
testdrive3
/
test.php
/
/
<?php require __DIR__ . '/vendor/autoload.php'; $api_key = 'AIzaSyAkxTA5CRBfALURGogZW_MLkybI_ifpKkM'; function addTrailingSlash ($path) { return rtrim ($path, '/') . '/'; } /** * Returns an authorized API client. * @return Google_Client the authorized client object */ function getClient() { // Change this to a secure location where you'll save your config *.json files // Make sure it isn't publicly available on the web $configPath = addTrailingSlash (getcwd()); // This get's generated by the script, so don't create it $credentialsPath = $configPath . 'credentials.json'; $client = new Google_Client(); // Matches the "Application Name" you enter during the "Step 1" wizard $client->setApplicationName( 'API App Name' ); $client->setScopes( Google_Service_Drive::DRIVE_FILE ); // You need to go through "Step 1" steps to generate this file: https://developers.google.com/sheets/api/quickstart/php $client->setAuthConfig( $configPath . 'client_secret_622867803455-baonbhsgva6s6vvufrn3d29sk17hsp7d.apps.googleusercontent.com.json' ); $client->setAccessType( 'offline' ); // This must match the "callback URL" that you enter under "OAuth 2.0 client ID" in the Google APIs console at https://console.developers.google.com/apis/credentials $client->setRedirectUri( 'https://www.mini-borishof.ru/test-drive2/test.php' ); // We have a stored credentials file, try using the data from there first if ( file_exists( $credentialsPath ) ) { $accessToken = json_decode( file_get_contents( $credentialsPath ), true ); } // No stored credentials found, we'll need to request them with OAuth else { // Request authorization from the user $authUrl = $client->createAuthUrl(); if ( ! isset( $_GET['code'] ) ) { header( "Location: $authUrl", true, 302 ); exit; } // The authorization code is sent to the callback URL as a GET parameter. // We use this "authorization code" to generate an "access token". The // "access token" is what's effectively used as a private API key. $authCode = $_GET['code']; $accessToken = $client->fetchAccessTokenWithAuthCode( $authCode ); // Create credentials.json if it doesn't already exist (first run) if ( ! file_exists( dirname( $credentialsPath ) ) ) { mkdir( dirname( $credentialsPath ), 0700, true ); } // Save the $accessToken object to the credentials.json file for re-use file_put_contents( $credentialsPath, json_encode( $accessToken ) ); } // Provide client with API access token $client->setAccessToken( $accessToken ); // If the $accessToken is expired then we'll need to refresh it if ( $client->isAccessTokenExpired() ) { $client->fetchAccessTokenWithRefreshToken( $client->getRefreshToken() ); file_put_contents( $credentialsPath, json_encode( $client->getAccessToken() ) ); } return $client; } function create_folder($service,$foldername){ $fileMetadata = new Google_Service_Drive_DriveFile([ 'name' => $foldername, 'mimeType' => 'application/vnd.google-apps.folder' ]); $folder = $service->files->create($fileMetadata, ['fields' => 'id']); return $folder->id; } // Get the API client and construct the service object. $client = getClient(); //$service = new Google_Service_Sheets( $client ); $service = new Google_Service_Drive($client); $foldername = 'test'; $optParams = array( 'pageSize' => 10, 'fields' => 'nextPageToken, files(id, name)', 'q' => "mimeType = 'application/vnd.google-apps.folder' AND trashed != true" ); $results = $service->files->listFiles($optParams); if (count($results->getFiles()) == 0) { $folder_id = create_folder($service,$foldername); } else { print "Files:\n"; foreach ($results->getFiles() as $file) { if($file->getName() == $foldername){ $folder_id = $file->getId(); } printf("%s (%s)\n", $file->getName(), $file->getId()); } } if(!isset($folder_id)){ $folder_id = create_folder($service,$foldername); } $fileMetadata = new Google_Service_Drive_DriveFile([ 'parents' => array($folder_id), 'addParents' => $folder_id, ]); $file_name = 'Report.csv'; $fileMetadata->setName($file_name); $fileMetadata->setDescription('Это документ ' . 'application/vnd.google-apps.spreadsheet'); $fileMetadata->setMimeType('application/vnd.google-apps.spreadsheet'); $content = file_get_contents('files/report.csv'); $file = $service->files->create($fileMetadata, array( 'data' => $content, 'mimeType' => 'text/csv', 'uploadType' => 'multipart', 'fields' => 'id')); printf("File ID: %s\n", $file->id);
/var/files/need-2-delete/./mini-borishof.ru1/testdrive3/test.php