簡體   English   中英

使用網絡工具在Google+域中發布

[英]Post in Google+ Domains using web tools

如果有人知道我如何使用PHP在Google +上發布內容。 我使用了Google plus Domains API,但它僅提供讀取權限。 如果我可以通過g suite做到,請告訴我該怎么做。

//添加代碼

$client = new \Google_Client();
    $client>setAccessToken(unserialize(get_option('google_access_token')));
    $plus = new \Google_Service_Plus($client);
    $plusDomain = new \Google_Service_PlusDomains($client);
    $activity = new \Google_Service_PlusDomains_Activity();
    $obj = new \Google_Service_PlusDomains_ActivityObject();
    try{

        $userId = $plusDomain->people->get('me')->id;



        $obj->setContent("Test text");
        $obj->setActor($userId);

        $activity->setObject($obj);
        $activity->setActor($userId);

        $activity->setTitle("title");


        $plusDomain->insert($userId,$activity);

在線setActor我的代碼無法繼續http://i.prntscr.com/yM7xybRnTzy8H97jY7DKCg.png

有兩種不同的API,您的問題似乎是將它們結合在一起。 使用的Google+ API授予對Google+社交媒體網站的只讀訪問權限。 Google plus域api,使您可以發布到您的Google plus域帳戶(gsuite)。

您說您要發布到Google+,前提是您的意思是社交媒體網站,那么答案是您不能像已經聲明的那樣將Google+ API設為只讀。

您的代碼似乎使用的是Google+域api,您需要確保通過身份驗證的用戶有權訪問google +域帳戶(如果該帳戶無法正常工作),請管理員檢查用戶對域帳戶的訪問權限

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM