开发者

Post to Facebook wall without using PHP-SDK?

开发者 https://www.devze.com 2023-03-29 13:57 出处:网络
I don\'t want to add SDK to my project, but I want to post messages to FB Page (public page, not /me).

I don't want to add SDK to my project, but I want to post messages to FB Page (public page, not /me). As I understood I need to do smt like this

curl -F 'access_token=...' \
     -F 'message=Check out this funny article' \
     -F 'link=http://www.example.com/article.html' \
     -F 'picture=http://www.example.com/article-thumbnail.jpg' \
     -F 'name=Article Title' \
     -F 'caption=Caption for the link' \
     -F 'description=Longer description of the link' \
     -F 'actions={"name": "View on Zombo", "link": "http://www.zombo.com"} \
     -F 'privacy={"value": "ALL_FRIENDS"} \
     https://graph.facebook.com/me/feed

How I can get access tok开发者_StackOverflowen key for that? When I use token from request https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=xxx&client_secret=yyy it says that it token can be used only for client info (client_credintials). I need another grant_type, or another params?


for your version you would need the publish_stream permission from the user, which would only work if you have requested the perm. so you would need js SDK or php (or any other serverside) SDK

you can make it even more simpler if you just to this url:

http://www.facebook.com/dialog/feed?
  app_id=123050457758183&
  link=http://developers.facebook.com/docs/reference/dialogs/&
  picture=http://fbrell.com/f8.jpg&
  name=Facebook%20Dialogs&
  caption=Reference%20Documentation&
  description=Dialogs%20provide%20a%20simple,%20consistent%20interface%20for%20applications%20to%20interact%20with%20users.&
  message=Facebook%20Dialogs%20are%20so%20easy!&
  redirect_uri=http://www.example.com/response

see https://developers.facebook.com/docs/reference/dialogs/feed/ or http://developers.facebook.com/docs/reference/javascript/FB.ui/ for more examples.


All I wanted to know is:

1) Auth app in dialog:

https://www.facebook.com/dialog/oauth?client_id=xxx&scope=publish_stream,offline_access&redirect_uri=http://site.com

2) Get "forever" access token:

https://graph.facebook.com/oauth/access_token?client_id=xxx&client_secret=yyy&code=zzz&redirect_uri=http://site.com

3) Post to wall:

https://graph.facebook.com/me/feed?access_token=aaa&message=msg
0

精彩评论

暂无评论...
验证码 换一张
取 消