I have to check in my script if a user like a facebook page.
I would realize it without Facebook app. I would not create it.
I founded some examples, but they require a Facebook app, and that user gives it the correct permission.
Can you help me? Is it possible?
Thanks for any suggestion.
You need to use the Facebook API and ask for permission from the user to do this.
Resources:
Facebook API info
User info
If your application is an external website, then you need to use the Facebook API and ask for the user_likes permission + valid access and make a POST to USER_ID/likes/PAGE_ID
If your application is a canvas or a tab application, then you can use the signed_request parameters that Facebook send you.
https://developers.facebook.com/docs/howtos/login/signed-request/
https://developers.facebook.com/docs/reference/api/user/
Regards
Related
I want to link a user to make a share post on my fb company page without having to authenticate. Currently I can get them to share on their own wall with:
But I'm not sure how I can get this to share to a page's wall rather than their timeline.
I got somewhat close by using the dialog feature:
https://www.facebook.com/dialog/feed?app_id=xxx&link=xxx&picture=xxx&name=xxx&caption=xxx&description=xxx&redirect_uri=xxx
But that just showed it as a normal share but done "via appName", unless there is a step I'm missing to link my app to my facebook page?
Thank you!
Unfortunately, the sharer.php method is used only to share only on the user's timeline.
If you want to ask the user to post on a page's timeline, you have to create an app, ask the user to authenticate it and then use the Facebook APIs to post on their behalf. I guess that will be cumbersome in your case, so I would just suggest you redirect to the particular Facebook page.
You can't !
To publish on YOUR page timeline, users need to have the rights to do it (be admin, writer, ...) : it's a manual requirement on the Facebook interface.
Am working on an application that should be able to write unto the wall of a friend after the user authorizes it. Currently, i can write unto my wall successfully through the application using the facebook graph API. Am facing difficulty in writing to a friends wall using the app. I have not been able to figure out whether i need extra permissions to do so or if need to do something different. I would be grateful if anyone could help me with any lead.
Thanks.
You have to get an extended permissions for your app: publish_stream.
For reference see: http://developers.facebook.com/docs/authentication/permissions/
publish_stream - Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends...
Good luck
I need to grab the statuses from a Facebook page via PHP to display on the page. I don't want to have people logging in to facebook just for my script to grab the statuses from the page since it is a public page and isn't restricted. I have the Facebook API for PHP in my projects directory but have no idea how to use it to do what I want it to. Could someone give me a code example of how I'd do this? Thanks!
It's really a straight forward task if you follow the documentation. Since /PAGE_ID/feed requires any valid access_token, your app access_token is enough to get the data:
Open the Graph API Explorer (I'm querying coca-cola/feed)
Get an app access_token from the Access Token Tool and use it instead of yours
You're done!
I'm making a facebook app and have got as far as getting the user to allow my apps permissions, which then generates a code. Then using this code to get an access token. So I now have a variable in my PHP script containing the access token. Now how do I use this to post to the users wall?
The easiest way to post a message on the wall is through the graph api. You require the publish_stream permission to post status messages. You can simply do a POST with the desired message and the access token.
See the official facebook documentation for more details: http://developers.facebook.com/docs/reference/api/status/
Facebook changes their API so often, it's best to read their docs, if those are up to date...
Check in IRC #facebook as well.
But basically, you pass that token in to the API call somewhere, somehow and it's in their docs somewhere.
Unless FB has decided you don't need it or ignores it or doesn't want to allow that this week.
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.
e.g. 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.