使用PHP客户端访问Google搜索引擎列表

时间:2015-09-19 20:41:35

标签: php google-api-php-client google-custom-search

我正在使用Google的API client for PHP,它可以很好地获取搜索结果。但我想要做的是获取我帐户中的自定义搜索引擎列表。我有这段代码:

$client = new Google_Client();
$client->setApplicationName('Google CustomSearch PHP Application');
$client->setDeveloperKey('[key]');
$client->setClientId('[client_id');
$client->setClientSecret('[client_secret]');
$search = new Google_Service_Customsearch($client);

然后,如果我想进行搜索,例如,这会产生结果:

$result = $search->cse->listCse('test', array('cx' => '[cse_id]'));

所以我知道它有效。但我希望能够在these instructions之后进行检索CSE列表的调用:

  

一个帐户可以有多个搜索引擎。检索   完整的帐户自定义搜索引擎列表,发送一个   经过身份验证的GET请求到以下URL:

     

http://cse.google.com/api/[USER_ID]/cse/[CSE_ID]

问题在于我不知道如何将此调用转换为适用于PHP的Google API客户端的语法。

0 个答案:

没有答案
相关问题