用户Facebook墙上的消息发布(msg post on user facebook wall)

编程入门 行业动态 更新时间:2024-10-26 18:30:02
用户Facebook墙上的消息发布(msg post on user facebook wall)

我想发布用户fb墙谁谁登录...即时通讯使用此代码..它在应用程序管理员墙上工作正常,但未能在其他用户发布... plz帮助

<?php include_once ('facebook-php-sdk-master\src\facebook.php'); $appId = 'app id'; //Facebook App ID $secret = 'app secret'; // Facebook App Secret $returnurl = 'localhost/check/index4.php'; //return url (url to script) $permissions = 'publish_actions, manage_pages'; //Required facebook permissions $fb = new Facebook(array('appId'=>$appId, 'secret'=>$secret)); $fbuser= $fb->getUser(); if($fbuser){ if(isset($_POST['text']) and $_POST['text']!='' ){ try{ $message= array( 'message'=>$_POST['text'] ); $url='/me/feed'; $result= $fb->api($url,'POST',$message); if($result){ echo "Data posted to facebook Succefull"; }else { echo"Not Posted"; } }catch(FacebookApiException $error){ echo $error->getMessage(); } } ` try{ /* $qry='select page_id, name from page where page_id in (select page_id from page_admin where uid='.$fbuser.' )'; $page=$fb->api(array('method'=>'fql.query','query'=>$qry)); if(empty($page)){ echo "user do not have any page to post"; } else{ echo "user has page!"; } */ echo '<form action="" method="post" name="check">'; echo '<textarea name="text"></textarea>'; echo '<input type="submit" value="Post"/>'; echo '</form>'; }catch(FacebookApiException $error){ echo $error->getMessage(); }

}

`

else { $loginurl= $fb->getLoginUrl(array('scope'=>$permissions, 'redirect-url'=>$returnurl)); echo '<a href="'.$loginurl.'" >Login with Fb</a>'; } ?>

它仅在管理员墙上发送评论

i want to post on user fb wall whoever login... i m using this code.. it is working fine on app administrator wall but failed to post on other user... plz help

<?php include_once ('facebook-php-sdk-master\src\facebook.php'); $appId = 'app id'; //Facebook App ID $secret = 'app secret'; // Facebook App Secret $returnurl = 'localhost/check/index4.php'; //return url (url to script) $permissions = 'publish_actions, manage_pages'; //Required facebook permissions $fb = new Facebook(array('appId'=>$appId, 'secret'=>$secret)); $fbuser= $fb->getUser(); if($fbuser){ if(isset($_POST['text']) and $_POST['text']!='' ){ try{ $message= array( 'message'=>$_POST['text'] ); $url='/me/feed'; $result= $fb->api($url,'POST',$message); if($result){ echo "Data posted to facebook Succefull"; }else { echo"Not Posted"; } }catch(FacebookApiException $error){ echo $error->getMessage(); } } ` try{ /* $qry='select page_id, name from page where page_id in (select page_id from page_admin where uid='.$fbuser.' )'; $page=$fb->api(array('method'=>'fql.query','query'=>$qry)); if(empty($page)){ echo "user do not have any page to post"; } else{ echo "user has page!"; } */ echo '<form action="" method="post" name="check">'; echo '<textarea name="text"></textarea>'; echo '<input type="submit" value="Post"/>'; echo '</form>'; }catch(FacebookApiException $error){ echo $error->getMessage(); }

}

`

else { $loginurl= $fb->getLoginUrl(array('scope'=>$permissions, 'redirect-url'=>$returnurl)); echo '<a href="'.$loginurl.'" >Login with Fb</a>'; } ?>

It send comment on administrator wall only

最满意答案

来自更改日志 :

申请超过public_profile,电子邮件和user_friends权限的应用必须经过Facebook审核,然后才能向用户请求这些权限。

publish_actions和manage_pages需要经过Facebook审核才能为其他人工作。 未经批准,它们仅适用于在App(Admin / Dev / Tester)中具有角色的用途。 有关更多信息,请参阅此页面: https : //developers.facebook.com/docs/apps/review/login

From the changelog:

Apps requesting more than public_profile, email and the user_friends permission must be reviewed by Facebook before those permissions can be requested from people.

publish_actions and manage_pages need to get reviewed by Facebook before they work for anyone else. Without approval, they will only work for uses with a role in the App (Admin/Dev/Tester). See this page for more information: https://developers.facebook.com/docs/apps/review/login

更多推荐

本文发布于:2023-04-27 21:30:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329048.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:墙上   消息   用户   Facebook   msg

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!