Google BigQuery API PHP Credential(Google BigQuery API PHP 凭证)
问题描述
我想实现 Google BigQuery API,以便我可以从 BigQuery 中的 PHP 代码执行查询.
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:
其次,我通过以下命令安装了 Google Cloud SDK:
Second I have installed the Google Cloud SDK by following command:
然后我运行这个命令来创建凭证:
Then I run this command to create the credential:
所有过程都成功,运行凭据请求后,我收到以下消息:
All the process is success and after run credential request I get the following message:
然后我想在 PHP 上运行这段代码:
Then I want to run this code on PHP:
但不幸的是我收到以下消息错误:
But unfortunately I got following message error:
所以我的问题是:出了什么问题,我该怎么办?
So my question is: whats wrong and what must I do?
谢谢
推荐答案
默认凭据由 适用于 PHP 的 Google API 客户端库,版本 2.0.0 及更高版本.要使用它们,请调用 useApplicationDefaultCredentials:
Default credentials are provided by the Google APIs Client Library for PHP, versions 2.0.0 and newer. To use them, call useApplicationDefaultCredentials:
然后,使用凭据访问 API 服务,如下所示:
Then, use the credentials to access an API service as follows:
我建议查看我提供的链接有更多选项,我们建议使用服务帐户
.
I am suggesting checking out the link I gave it has much more options and we recommend using service accounts
.
这篇关于Google BigQuery API PHP 凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!