2016 m. lapkričio 20 d., sekmadienis
google drive failu nuskaitymas su php
//reikalingas service accont iš https://console.developers.google.com
$client = new Google_Client();
$credentialsFile = __DIR__ . '/googleserviceaccount.json';
if (!file_exists($credentialsFile)) {
throw new RuntimeException('Service account credentials Not Found!');
}
$client->setAuthConfig($credentialsFile);
$client->setApplicationName("Service Account Example");
$client->setScopes(Google_Service_Drive::DRIVE);
$service = new Google_Service_Drive($client);
//glaime rodyti tik is tam tikro folderio
$files = $service->files->listFiles(array('q' => "'0B6Gt1nOByOdfsdfdsfsdZ3BqOGc' in parents"));
//failu sarasas
var_dump($files);
//failo turinys
$content = $service->files->export('13yrUsfsdfdsfsdfsdf454u_LC1eJA1mNs', 'text/html', array(
'alt' => 'media' ));
var_dump($content->getBody()->read(1024));
Užsisakykite:
Rašyti komentarus (Atom)
Komentarų nėra:
Rašyti komentarą