5
A
回答
2
过了一段时间,我发现它。
http://code.google.com/p/google-plus-php-starter/
这
https://developers.google.com/+/api/latest/activities/list
唯一的问题是,您需要登录到您的谷歌应用程序做到这一点。任何建议都会很有帮助。
10
您可以执行activities.list,无需进行身份验证,只需将API console中的“简单”密钥传递给创建的Google+服务已打开的项目即可。访问API调用仅限于您在项目中设置的授权源。
创建项目后,在“简单API访问”部分中有一个API密钥。与此键,您的客户端ID和客户端密钥建立你的客户端:
<?
$client = new Google_Client();
$client->setDeveloperKey("YOUR_API_KEY");
$plus = new Google_PlusService($client);
$activities = $plus->activities->listActivities("+GooglePlusDevelopers", "public");
?>
<html><body><pre><? echo print_r($activities);?></pre></body></html>
最后需要说明的,请确保您使用latest Google+ PHP client。
+0
在当前谷歌php客户端中不包含此文件,,,,,,, Google_PlusService.php ,,,,,,, 从哪里可以得到完整的库? – Kiran
2
更新正确的答案,正如格斯上面所说的类名称已更改为Google_Service_Plus
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ .'/vendor/google/apiclient/src');
require_once __DIR__.'/vendor/autoload.php';
$client = new Google_Client();
$client->setDeveloperKey("YOUR_API_KEY");
$plus = new Google_Service_Plus($client);
$activities = $plus->activities->listActivities("+GooglePlusDevelopers", "public");
?>
$items = $activities->getItems();
foreach($items as $item) {
$object = $item->getObject();
?>
<div class="gpost">
<p><?php echo $object->getContent(); ?></p>
<a href="<?php echo $item['url']; ?>">Read more</a>
</div>
<?php } ?>
相关问题
- 1. C#使用placeid获取Google plus页面
- 2. 获取Facebook页面帖子
- 3. 使用REST API从Google+公司页面获取最新帖子
- 4. 在Google Plus上获取用户的帖子
- 5. Google Plus集成以获取配置文件帖子
- 6. 如何从Google +流中获取帖子
- 7. Google+ API - 在商业页面上获取帖子的问题
- 8. 获取无页面帖子的流
- 9. 在Google plus中发布WordPress的帖子?
- 10. Google Plus无法创建帖子。稍后
- 11. 从WordPress的帖子获取页面分页信息
- 12. 在Wp-admin中的帖子页面中获取帖子ID
- 13. 如何从侧边栏获取帖子以显示为常规帖子页面
- 14. 从posts_where里面获取帖子id wordpress
- 15. 连接到Google Plus作为页面/获取用户管理的页面
- 16. 作者页面获取作者的帖子和页面
- 17. WordPress的 - 在单个帖子页面(循环外)获取帖子偏移量/帖子页面偏移量
- 18. 获取Google Plus朋友Android
- 19. 获取页面编号,而分页wordpress帖子页
- 20. 从facebook页面获取最新帖子(feed)
- 21. 从Facebook页面获取所有帖子和评论
- 22. 按日期从Facebook页面获取帖子
- 23. 从公共FB页面获取陈旧的Facebook帖子
- 24. 如何使用javascript或php从facebook页面获取帖子
- 25. 从facebook页面获取最新帖子和评论
- 26. 使用Facebook4j api从页面获取帖子
- 27. 从Facebook页面的预定帖子获取预定时间
- 28. 使用RestFB API从页面获取帖子
- 29. 从页面的帖子(Facebook GraphAPI - Android)获取多张图片ID
- 30. 使用Google People API获取用户Google Plus封面图片
,不需要认证。如果您使用API密钥建立Plus客户端,则无需登录Google+即可进行这些API调用。 – Joanna