简体   繁体   中英

How to post on user's facebook wall?

I am working to post some content to user's wall from my website.

I created an application on facebook.

Should I manually create a dialog box redirecting user to something like that?

http://www.facebook.com/dialog/oauth/?
  scope=email,user_birthday&
  client_id=123050457758183&
  redirect_uri=http://www.example.com/response&
  response_type=token

How can I check if user already connected application on my website?

Should I store any of the user's facebook data when he allows my application to remember if already connected?

Data comes like that as told in http://developers.facebook.com/docs/reference/dialogs/oauth/

http://www.example.com/response#
  access_token=...&
  expires_in=3600

Then how can I post some contect with PHP?

I read something here but cant understand actually...

http://developers.facebook.com/docs/reference/api/post/

Any help appreciated

Thanks

Did you check out the PHP SDK ? There's an example showing how to authenticate a user in there and to post to the wall, check out the " graph()" (which you cannot call directly, you can call "post" directly on the facebook class if I recall, see the " _call()" method) method and check out the documentation again.

Let me know if that helps otherwise we'll take it from there.

Facebook session parameters will help you to found out whether user in connected to your app or not. eg if you are using php-sdk

$session = $facebook->getSession();

if($session)

//do something

else

//do something

I find the PHP SDK for "viral" channel convoluted and a poor user experience. Checking if the user has "auhtorized" your app is easy, as was pointed out already. But if the user hasn't, then requesting authorization is a lot of back and forth communication (http://developers.facebook.com/docs/authentication/). That's before you can post to their wall. Which still requires redirects if done from the server (http://developers.facebook.com/docs/reference/dialogs/).

I find it a lot easier to use the javascript SDK. Check if they have authorized your app (FB.getLoginStatus), if not then ask for authorization (FB.login), then use FB.ui to post to their own wall or a friend's wall. It's all done client side, no calls back to the server necessary, no page reloads or redirects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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