Php 搜索谷歌&x2B;公开帖子和页面的api
我正在尝试使用GoogleAPI php客户端SDK和GooglePlus api服务。文件不是很清楚。我需要搜索活动吗?我需要获得oAuth令牌才能执行我想要的操作吗 更新:现在使用Php 搜索谷歌&x2B;公开帖子和页面的api,php,google-api,google-plus,Php,Google Api,Google Plus,我正在尝试使用GoogleAPI php客户端SDK和GooglePlus api服务。文件不是很清楚。我需要搜索活动吗?我需要获得oAuth令牌才能执行我想要的操作吗 更新:现在使用 $params = array( 'orderBy' => 'best', 'maxResults' => '20', 'query' => 'Google+ API' );
$params = array(
'orderBy' => 'best',
'maxResults' => '20',
'query' => 'Google+ API'
);
$results = $plus->activities->search($params);
返回
Array
(
[kind] => plus#activityFeed
[etag] => "5NTCbsXue5u92XtxuV0QeM_x9B4/58mHUy-IErItGIABIAhYhhUjJ-M"
[selfLink] => https://www.googleapis.com/plus/v1/activities?query&maxResults=10
[title] => Plus Search
[updated] => 2012-09-27T14:03:35.132Z
[id] => tag:google.com,2010:es-search-feed:z80ghJXVZe9m59_5-Ydk2g
[items] => Array
(
)
)
搜索活动不需要OAuth令牌。您只需要在GoogleAPI控制台中注册开发者密钥
$params = array(
'orderBy' => 'best',
'maxResults' => '20',
'query' => 'Google+ API'
);
$results = $plus->activities->search($params);
foreach($results['items'] as $result) {
print "Result: {$result['object']['content']}\n";
}
我也遇到了同样的问题,下面是我如何解决的:
$query = "some query";
$params = array(
'orderBy' => 'best',
'maxResults' => '20',
);
$results = $plus->activities->search($query, $params);
foreach($results['items'] as $result) {
print "Result: {$result['object']['content']}\n";
}
即使示例查询中的面团也是参数的一部分,但事实并非如此。它应该作为分隔值发送,正如您在plus服务的搜索方法的实现中所看到的那样
希望这对您有所帮助。我没有收到任何返回的结果。用返回的内容更新问题。还有一个警告:rawurlencode()希望参数1是字符串,数组给定googleplus/google-api-php-client/src/io/apiREST.php,第129行]