unifcationengine不使用谷歌+分享

时间:2017-01-19 11:57:39

标签: php unificationengine

嗨当我在google plus中通过unification-engine api发送消息时,我收到此错误

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

我的代码是

$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];

2 个答案:

答案 0 :(得分:0)

请按照以下方式更改接收器部分并检查是否可以发布消息

"接收机" =>阵列(

array(
"name"=> "page",

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

答案 1 :(得分:0)

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

$departments = json_decode($json_string, true);
$result = array();
foreach ($departments as $dept) {
    $name = $dept['department'];
    foreach ($dept['sections'] as $sectno => $secdata) {
        $secdata['dept'] = $name;
        $secdata['section'] = $sectno;
        $result[] = $secdata;
    }
}