unifcationengine not working with google+ sharing

爷,独闯天下 提交于 2019-12-06 16:13:48

问题


Hi When I am sending a message by unification-engine api in google plus then I am getting this error

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 working fine with facebook and twitter but its not working with googleplus

My code is

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

回答1:


Can you please change the receivers part as follows and check whether you can post message

"receivers" => array(

array(
"name"=> "page",

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

)




回答2:


I could able to send by using following sample code. Can you please try with this?

<?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);

?>


来源:https://stackoverflow.com/questions/41741241/unifcationengine-not-working-with-google-sharing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!