首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不使用google+共享的统一引擎

不使用google+共享的统一引擎
EN

Stack Overflow用户
提问于 2017-01-19 11:57:38
回答 2查看 141关注 0票数 0

嗨,当我用google中的统一引擎api发送消息时,我收到了这个错误。

代码语言:javascript
复制
stdClass Object
(
    [Status] => stdClass Object
        (
            [GP] => stdClass Object
                (
                    [status] => 504
                    [info] => 504 Connection Error: Post https://googleplus-v2connector.unificationengine
.com/v2/message/send: EOF: 
                )

        )

    [URIs] => Array
        (
        )

)

unificationengine api在facebook和twitter上运行良好,但与googleplus不兼容

我的代码是

代码语言:javascript
复制
$app = new UEApp("APP_KEY","APP_SECRATE");
$user = new UEUser("USER_KEY","USER_SECRET");
$connection = $user->add_connection('google', "googleplus",  $access_token);
$options = array(
    "receivers" => array(
         array(
                "name"=> "Me"
         )
     ),
     "message"=>array(
         "subject"=>"ABC",
          "body"=> "",
          "image"=>$shareImageUrl,
           "link"=>array(
                "uri"=> $link,
                 "description"=> "",
                 "title"=>"Click here for view"
            )
       )
    );
//Send the message and get their uris
$uris = $connection->send_message($options);
print_r($uris);
$myArray = explode('/', $uris[0]);
return $myArray[3];
EN

回答 2

Stack Overflow用户

发布于 2017-01-23 06:09:17

请您按以下方式更改接收方部分,并检查是否可以发送消息

“接收器”=>阵列(

代码语言:javascript
复制
array(
"name"=> "page",

"id"=> "PAGE_ID"// PAGE_ID is id of the page which you have to post message
)

)

票数 0
EN

Stack Overflow用户

发布于 2017-01-27 04:24:30

我可以使用下面的示例代码发送。你能试试这个吗?

代码语言:javascript
复制
<?php

    require 'vendor/autoload.php';
    use UnificationEngine\Models\UEUser;

    $user = new UEUser("USER_ACCESSKEY","USER_ACCESSSECRET");

    $connection = $user->add_connection("google","googleplus","ACCESS_TOKEN@googleplus.com/?id=PAGE_ID&refresh_token=REFRESH_TOKEN&is_profile=false");

    $options = array(
        "receivers" => array(
            array(
                "name"=> "page",
                "id"=> "PAGE_ID"// page id in which page you have to send
            )
        ),
        "message"=>array(
            "subject"=>"ABC111",
            "body"=> "",
            "image"=>"http://politibits.blogs.tuscaloosanews.com/files/2010/07/sanford_big_dummy_navy_shirt.jpg",
            "link"=>array(
                "uri"=> "http://google.com",
                "description"=> "",
                "title"=>"Click here for view"
            )
        )
    );

    //Send the message and get their uris
    $uris = $connection->send_message($options); 

    print_r($uris);

?>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41741241

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档