FacebookはPHPを使用してストリームを直接公開します
-
22-10-2019 - |
質問
FacebookのWebサイトWallページにストリームを公開しようとしています。
これまでのところ、私はアプリページを介してストリームを公開することに成功しましたが、私は望んでいません、私は直接公開したいです。
前にも言ったように、アプリの壁のページではなく、FacebookのWebサイトの壁のページに公開したいと思います。
役に立つものは何も見つかりませんでした...それが可能であれば、PHPで公開したいのです。とにかくどうすればそれができますか?
解決
これが私がPHPでそれをする方法です:
//Note that you will need to have the access token which is what gives permission to write.
function self_fb_post($to_uid,$acToken) {
global $fb; //this is the fb object
$result = false;
$feed_dir = '/'.$to_uid.'/feed/'; //to the UID you want to send to
$message_str = 'Why does facebook development not have decent support';
$msg_body = array('access_token' => $acToken,
'name' => 'My wall post',
'message' => $message_str,
'caption' => "www.mysite.com",
'link' => 'http://www.mysite.com',
'description' => 'A wall post which is used to express the frustration of working with crappy facebook developer documentation',
'picture' => 'http://farm6.static.flickr.com/1111/some-pic.jpg',
'actions' => array(array('name' => 'My Site',
'link' => 'http://www.mysite.com'))
);
try {
//this is the API call that does it all
$result = $fb->api($feed_dir, 'post', $msg_body);
}
catch (Exception $e) {
$err_str = $e->getMessage();
}
return $result;
}
所属していません StackOverflow