Google BigQuery API PHP Credential

前端 未结 1 1238
-上瘾入骨i
-上瘾入骨i 2021-01-20 02:05

I want to implement Google BigQuery API so I can execute query from my PHP code in BigQuery.

First I have installed the client library by following command:

相关标签:
1条回答
  • 2021-01-20 02:26

    Default credentials are provided by the Google APIs Client Library for PHP, versions 2.0.0 and newer. To use them, call useApplicationDefaultCredentials:

    $client = new Google_Client();
    $client->useApplicationDefaultCredentials();
    

    Then, use the credentials to access an API service as follows:

    $client->setScopes(['https://www.googleapis.com/auth/books']);
    $service = new Google_Service_Books($client);
    $results = $service->volumes->listVolumes('Henry David Thoreau');
    

    I am suggesting checking out the link I gave it has much more options and we recommend using service accounts.

    0 讨论(0)
提交回复
热议问题