我想使用PHP发布片刻。我搜索了很多,但我没有得到任何有用的例子...我发布的时刻我用过:
$moment_body = new Google_Moment();
$moment_body->setType("http://schema.org/AddAction");
$item_scope = new Google_ItemScope();
$item_scope->setUrl("https://developers.google.com/+/plugins/snippet/examples/thing");
$moment_body->setObject($item_scope);
$momentResult = $plus->moments->insert('me', 'vault', $moment_body);
# This example shows how to create moment that does not have a URL.
$moment_body = new Google_Moment();
$moment_body->setType("http://schema.org/AddAction");
$item_scope = new Google_ItemScope();
$item_scope->setId("target-id-1");
$item_scope->setType("http://schema.org/AddAction");
$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->setObject($item_scope);
$momentResult = $plus->moments->insert('me', 'vault', $moment_body);
然而,它并没有插入时刻。
答案 0 :(得分:2)
DalmTo是正确的,您无法在Google+信息流上发布信息页。时刻是一个名为App Activities的功能:https://developers.google.com/+/features/app-activities,它没有被广泛使用(在UI中很难找到)。
有一个用于发布到Pages的API,但它仅限于少数合作伙伴,例如Hootsuite - 您可以使用其中一个作为中间人:https://www.google.com/+/brands/3rdpartytools.html