setAuthConfig($credentials_file); } elseif (getenv('GOOGLE_APPLICATION_CREDENTIALS')) { // use the application default credentials $client->useApplicationDefaultCredentials(); } else { echo missingServiceAccountDetailsWarning(); return; } $client->setApplicationName("Client_Library_Examples"); $client->setScopes(['https://www.googleapis.com/auth/books']); $service = new Google_Service_Books($client); /************************************************ We're just going to make the same call as in the simple query as an example. ************************************************/ $optParams = array('filter' => 'free-ebooks'); $results = $service->volumes->listVolumes('Henry David Thoreau', $optParams); ?>