HybridAuth autopost to facebook page

1.5k Views Asked by At

How can i autopost to my facebook page with hybridAuth?

I have a site and a facebook page for the site, i use hybridAuth for the login to the site, it is working fine, now i want to use the hybridAuth for some automate posts to the facebook page.
This is how you can post to the wall of a user with hybridAuth

$facebook = $hybridauth->authenticate( "Facebook" );

$facebook->api()->api("/me/feed", "post", array(
"message" => "Hi there",
"picture" => "http://www.mywebsite.com/path/to/an/image.jpg",
"link" => "http://www.mywebsite.com/path/to/a/page/",
"name" => "My page name",
"caption" => "And caption"
));
1

There are 1 best solutions below

0
On

This thread is quite old but someone out there may still be struggling with this challenge. You can post to a facebook users wall using hybridauth by simply using this function.

// init hybridauth
$hybridauth = new Hybrid_Auth( $config );

// try to authenticate with facebook
$adapter = $hybridauth->authenticate( "Facebook" );

// update the user status or post to wall
$adapter->setUserStatus(
array(
"message" => "", // status or message content
"link" => "", // webpage link
"picture" => "", // a picture link
)
);

For more details please visit the official page of hybridauth: http://hybridauth.sourceforge.net/userguide/Profile_Data_User_Status.html