0

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];
Kuldeep Raj
  • 791
  • 1
  • 7
  • 29

2 Answers2

0

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
)

)

AMT.in
  • 391
  • 1
  • 5
  • Now I am getting some error in fb and twitter+ sharing and same in google plus sharing "cURL error 28: Operation timed out after 10000 milliseconds with 0 bytes received" now I am not able to share any message on fb, twitter and googleplus – Kuldeep Raj Jan 23 '17 at 10:17
  • now I am getting this error in other working api {"status":504,"info":"504 Connection Error: Post https://pinterest-v2connector.unificationengine.com/v2/test: dial tcp 52.210.137.103:443: getsockopt: connection refused"} – Kuldeep Raj Jan 23 '17 at 11:33
  • how to get PAGE_ID – Kuldeep Raj Jan 23 '17 at 13:05
  • Please provide the sample code that you have tried. – AMT.in Jan 24 '17 at 05:41
  • I have using this now but I have used so many way for this."receivers" => array( array( "name"=> "page", "id"=> "106183509307451290442" ) ), I have replace page with 'Me' but getting same error – Kuldeep Raj Jan 24 '17 at 05:47
  • please provide me solution ASAP right now I am implementing in local – Kuldeep Raj Jan 24 '17 at 06:45
  • Can we have a look at the code that is throwing error for you? – AMT.in Jan 24 '17 at 10:12
  • please please provide me solution of this problem – Kuldeep Raj Jan 25 '17 at 07:20
0

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

?>
AMT.in
  • 391
  • 1
  • 5
  • I am getting this error when using same code. tdClass Object [Status] => stdClass Object ( [google] => stdClass Object ( [status] => 403 [info] => Access Not Configured. Google+ Pages API has not been used in project 38616112478 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/plusPages /overview?project=38616112478 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.: ) – Kuldeep Raj Jan 27 '17 at 06:10
  • Looks like permission issue. Please share the scopes that you have given. – AMT.in Jan 27 '17 at 07:13
  • I have added scope:'scope' => array('https://www.googleapis.com/auth/plus.stream.write', 'https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/plus.login') – Kuldeep Raj Jan 27 '17 at 07:26
  • Now I am using developer account but I am not able to add "plusPages" API. Error is : The API "plusPages" doesn't exist or you don't have permission to access it . Now I am using developer account but not able to set this permission If any idea then please provide me thanks – Kuldeep Raj Jan 27 '17 at 07:28