简体   繁体   English

HybridAuth自动发布到Facebook页面

[英]HybridAuth autopost to facebook page

How can i autopost to my facebook page with hybridAuth? 我怎么能自动过帐与hybridAuth我的Facebook页面?

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. 我有一个网站和该网站的Facebook页面,我使用hybridAuth登录到该网站,它工作正常,现在我想使用hybridAuth将一些自动张贴到Facebook页面的帖子使用。
This is how you can post to the wall of a user with hybridAuth 这是您可以使用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"
));

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. 只需使用此功能,您就可以使用hybridauth在Facebook用户墙上发布文章。

// 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 有关更多详细信息,请访问hybridauth的官方页面: http ://hybridauth.sourceforge.net/userguide/Profile_Data_User_Status.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM