在“使用谷歌加域API创建帖子”中设置类型



使用我的代码,我可以在我的个人资料上创建一个帖子,但它总是在我的个人资料上显示"与域共享",尽管我希望它是"公开的"。请帮助我,非常感谢。

这是我的代码:

$redirect_uri = 'http://' . $_SERVER['HTTP_HOST'] .
$_SERVER['PHP_SELF'];
$client = new Google_Client();
$client->setAuthConfig($oauth_credentials);
$client->setRedirectUri($redirect_uri);
$client->addScope('https://www.googleapis.com/auth/plus.me');
$client->addScope('https://www.googleapis.com/auth/plus.stream.write');
$client->setScopes('email');
$client->getAccessToken();
$client->verifyIdToken();
$plusdomains = new Google_Service_PlusDomains($client);
$activityObject = new Google_Service_PlusDomains_ActivityObject();
$activityObject->setContent("Somethings's not importance");
$activityAccess = new Google_Service_PlusDomains_Acl();
$activityAccess->setDomainRestricted(true);
$resource = new Google_Service_PlusDomains_PlusDomainsAclentryResource();
$resource->setType("public");
$resources = array();
$resources[] = $resource;
$activityAccess->setItems($resources);
$activity = new Google_Service_PlusDomains_Activity();
$activity->setObject($activityObject);
$activity->setAccess($activityAccess);
$plusdomains->activities->insert("me", $activity);

你试试看:

$resource->setType("domain")

https://developers.google.com/+/domains/posts/creating

相关内容

  • 没有找到相关文章

最新更新