【发布时间】:2014-04-23 06:37:42
【问题描述】:
我发现有关在 Google Plus 上发布的文章 https://developers.google.com/+/api/latest/moments/insert
从中我们可以找到示例显示如何创建时刻。
$moment_body = new Google_Moment();
$moment_body->setType("http://schemas.google.com/AddActivity");
$item_scope = new Google_ItemScope();
$item_scope->setId("target-id-1");
$item_scope->setType("http://schemas.google.com/AddActivity");
$item_scope->setName("The Google+ Platform");
$item_scope->setDescription("A page that describes just how awesome Google+ is!");
$item_scope->setImage("https://developers.google.com/+/plugins/snippet/examples/thing.png");
$moment_body->setTarget($item_scope);
$momentResult = $plus->moments->insert('me', 'vault', $moment_body);
从用于 PHP 的 Google API 客户端库中,我找不到关于 Google_ItemScope 的 api,而 Google_Moment 是 Google_PlusMomentsService.php。所以不能试试这个例子。
有人知道吗?或者有解决方案我可以尝试使用 PHP 在 Google 上自动发布吗?
谢谢
【问题讨论】:
-
Note: The Google+ API currently provides read-only access to public data. All API calls require either an OAuth 2.0 token or an API key.developers.google.com/+/api -
该示例使用的是旧版本的客户端库。尝试在 Google/Service/Plus.php 中查找 Google_Service_Plus_ItemScope,并以相同的方式使用(Moment 相同)。github.com/google/google-api-php-client/blob/master/src/Google/…
标签: php google-plus google-api-php-client