下次没有显示Facebook窗口,我想通过ajax发布到他的墙上.
怎么可能有任何关于此的帮助将不胜感激!
编辑
我用了给出的例子然后尝试了curl函数
得到了这个错误
HTTP/1.1 403 Forbidden Cache-Control: no-store Content-Type: text/javascript; charset=UTF-8 Expires: Sat,01 Jan 2000 00:00:00 GMT P3P: CP="Facebook does not have a P3P policy. Learn why here: http://fb.me/p3p" Pragma: no-cache WWW-Authenticate: OAuth "Facebook Platform" "insufficient_scope" "(#200) This API call requires a valid app_id." Set-Cookie: datr=g4JBTb4OsRZxBAztV7iIkpWg; expires=Sat,26-Jan-2013 14:34:43 GMT; path=/; domain=.facebook.com; httponly X-Cnection: close Date: Thu,27 Jan 2011 14:34:43 GMT Content-Length: 93 {"error":{"type":"OAuthException","message":"(#200) This API call requires a valid app_id."}}
编辑,以便有人可能找到有用的
FACEBOOK连接
$facebook_connect = array( 'appId' => 'YOUR APP_ID','secret' => 'YOUR SEC KEY','access_token'=>"USER'S ACCESS TOKEN",'cookie' => true );
发布到用户墙
$facebook->api("/PROFILE_ID/Feed","post",array( "message"=>"Hi Friends Join ****","name"=>"You're invited to join ****!","link"=>"www.****.com","description"=>"Great site","picture"=>"http://www.****.com/logo.jpg","caption"=>"Join *****" )
> Facebook绝不会与您分享用户密码!
>如果您只需要给用户分享链接的可能性,那么只需使用like plugin.您还可以在您的网站上找到更有趣的social plugins.
>如果您使用类似的插件,它将不会打开任何弹出窗口,它会将链接直接发布到用户的墙上.
>您可以随时使用Feed Dialog
>开始阅读Facebook Documentation
> app access_token
> publish_stream权限,不需要长期访问令牌:
Enables your app to post content,comments,and likes to a user’s
@H_404_50@
stream and to the streams of the user’s friends. This is a superset
publishing permission which also includes publish_actions. However,
please note that Facebook recommends a user-initiated sharing model.
Please read the Platform Policies to ensure you understand how to
properly use this permission. Note,you do not need to request the
publish_stream permission in order to use the Feed Dialog,the
Requests Dialog or the Send Dialog.需要许可:
这可以通过多种方式完成:
使用Login Plugin:<div class="fb-login-button" data-show-faces="true" data-width="200" data-scope="publish_stream" data-max-rows="1"></div>Server-side login(重定向到OAuth对话框):
https://www.facebook.com/dialog/oauth? client_id=YOUR_APP_ID &redirect_uri=YOUR_URL &scope=publish_stream &state=SOME_ARBITRARY_BUT_UNIQUE_STRING$loginUrl = $facebook->getLoginUrl(array("scope"=>"publish_stream"));FB.login(function(response) { if (response.authResponse) { console.log('Welcome! Fetching your information.... '); FB.api('/me',function(response) { console.log('Good to see you,' + response.name + '.'); FB.logout(function(response) { console.log('Logged out.'); }); }); } else { console.log('User cancelled login or did not fully authorize.'); } },{scope: 'publish_stream'});出版:
$USER_ID = "XXXXXXXX"; // Connected once to your APP and not necessary logged-in at the moment $args = array( 'message' => 'Hello from app','link' => 'http://www.masteringapi.com/','caption' => 'Visit MasteringAPI.com For Facebook API Tutorials!' ); $post_id = $facebook->api("/$USER_ID/Feed",$args);