PHP的谷歌驱动器API连接错误

时间:2018-08-02 12:46:13

标签: php google-drive-api google-api-php-client

我与Google云端硬盘的连接存在问题。

 <?
// include your composer dependencies
require_once 'vendor/autoload.php';

$client = new Google_Client();

$auth = [
  "type" => "web",
  "project_id" => "pobieganiedanych",
  "private_key" => "*******",
  "client_email" => "biel****om",
  "client_id" => "24*****tent.com",
  "auth_uri" => "https://accounts.google.com/o/oauth2/auth",
  "token_uri" => "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url" => "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url" => "https://www.googleapis.com/oauth2/v1/certs"
];

$client->setRedirectUri("http://localhost/test.php");
$client->setScopes(Google_Service_Drive::DRIVE_METADATA_READONLY);

$client->setAuthConfig($auth);




$auth_url = $client->createAuthUrl();
echo "<a href='$auth_url'>Login Through Google </a>";
$service = new Google_Service_Drive($client);
//var_dump($service->files->internal_gapi_mappings);
$optParams = array(
  'pageSize' => 10,
 // 'fields' => 'nextPageToken, files(id, name)'
);
$results = $service->files->listFiles();
//var_dump($results);

?>

它给出了这个错误

Fatal error: Uncaught exception 'Google_Service_Exception' with message '{ "error": { "errors": [ { "domain": "usageLimits", "reason": "dailyLimitExceededUnreg", "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.", "extendedHelp": "https://code.google.com/apis/console" } ], "code": 403, "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup." } } ' in C:\Program Files (x86)\Ampps\www\vendor\google\apiclient\src\Google\Http\REST.php:118 Stack trace: #0 C:\Program Files (x86)\Ampps\www\vendor\google\apiclient\src\Google\Http\REST.php(94): Google_Http_REST::decodeHttpResponse(Object(GuzzleHttp\Psr7\Response), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #1 [internal function]: Google_Http_REST::doExecute(Object(GuzzleHttp\Client), Object(GuzzleHttp\Psr7\Request), 'Google_Service_...') #2 C:\Program Files (x86)\Ampps\www\vendor\google\apiclient\src\Google\Task\Runner.php(181): call_user_func_array(Array, Array) #3 in C:\Program Files (x86)\Ampps\www\vendor\google\apiclient\src\Google\Http\REST.php on line 118

这是我在Google API中的登录设置

应用程序可在我的桌面上(且仅在此处)运行,并且通过http而非https连接到Google驱动器。

您对如何连接到我的驱动器有任何想法吗?

0 个答案:

没有答案