how to get like status of facebook php sdk - facebook

I am making event page on facebook by using facebook php sdk.
i added fb app to fb page.
the page was made for fb event.
i tried some ways. but all failed.
Now, i will make two pages.
one is after clicking like.
the other is before clicking like.
i use this soruce to get userf id.
$user = $facebook->getUser();
it is to get user id source.
i want to know to get like status.
how can i get like status about facebook php sdk.
please let me know it. ^^ plz

If it is a page tab app the signed request will contained a liked parameter. You can read about it on https://developers.facebook.com/docs/appsonfacebook/pagetabs

Related

Single Facebook App multiple Client Facebook Page Tab

I have created a Facebook Application which will be used as a Facebook Tab Page. My problem is that I am unable to get the page id.
I want to use this single application for multiple Facebook Page Tabs but the content will vary based on the Page Id.
The code I am trying to use to get the signed_request is using the JavaScript SDK.
FB.getLoginStatus(function(response) {
console.log(response);
})
This can be done with the signed_request parameter, which is passed on to your URL.
The easiest solution is to use the PHP SDK. It offers a function called "getSignedRequest": https://developers.facebook.com/docs/reference/php/facebook-getSignedRequest
Those are the fields of the signed_request parameter: https://developers.facebook.com/docs/reference/login/signed-request
If you donĀ“t want to use the PHP, you need to parse the parameter on your own. Check out this link for more information and search for "Parsing the Signed Request": https://developers.facebook.com/docs/facebook-login/using-login-with-games
Edit: you will not get the correct signed_request using the JavaScript SDK. Use PHP (or your server language) for this.
The mistake was that the URL added in the Facebook page tab settings was getting redirected as it did not have a "/"; there was a redirect for SEO added and the URL in the Facebook APP sittings did not have the "/".
So as it was getting redirected Facebook sent the POST variable but we have not handled it. Now it is fixed.
Special thanks to #luschn and #Fran Barbero for all your efforts in this.

Can't get facebook ID

I can't create an app for my FB page, when I try to access http://developers.facebook.com/apps/ I get redirected to my page. Does anyone else have a similar issue?
Sounds like you are using Facebook as your Page and not you.
Select the option use Facebook as you from your page and then you should be able to visit http://developers.facebook.com/apps/ and create an App. Shortcut link http://developers.facebook.com/setup/
Once created you can add said app to your page (still using Facebook as you and not your Page).

Getting Stream from Facebook page with neosmart

Im using neosmart jquery plugin to get streams from facebook to my own page.
The plugin requires the page id from the fanpage, and mostly its working ok.
But with the link https://www.facebook.com/midtfynsgymnasium i cant get anything.
I guess the page id is 121130641250864 but i cant get the data. Is it because they have put on a "noread" attribute ?
The Facebook ID is only the last part of your address: https://neosmart-stream.de/facebook/how-to-find-a-facebook-id/
Additionally your access token needs the permission read_stream.

Facebook page get user like status

I tried googling & checking stackoverflow for the possible solution but haven't found any yet, so would like to bring it up here again.
I have a Facebook page, page has multiple tabs, and one of the tab has a Facebook App (accessed only through the tab, redirect the http://apps.facebook.com/myapp to the page tab)
I have some content (say non-fan content) to be displayed to the user before he likes the page.but, I don't have any way to check if the user has liked the page unless he adds the app & fb documentation has stuff that can give me the required like FQL page_fan, url_like, api(/me/likes/FACEBOOK_PAGE_ID) but each one of this needs an accesstoken (which I cannot get before the user adds the app).
some of the posts on stackover flow says that is not possible without getting the user to add the app. but there are apps like static html, static iframe & others which provides this functionality, how ?
Please advise.
Facebook will POST a signed_request to your server when the user opens the page tab.
This is what you get when you parse the signed_request:
{
"algorithm":"HMAC-SHA256",
"issued_at":1309468031,
"page":{
"id":"xxxxxxxxxxxxxxx",
"liked":true,"admin":true
},
"user":{"country":"fr","locale":"en_US","age":{"min":21}
}
The important part is "page.liked" where you see if the user likes the page.
No permissions and no app authorization is needed for this to work.
Search the web about parsing the signed_request in your favorite web programming language i.e. php.

Feed dialog to event/fan page says "Sorry, something went wrong." after clicking share

Having some issues with the feed dialog when attempting to post to a event or fan page. In my application I am using the JS API and FB.ui using the method feed.
But for a demonstration you can do it using the feed url too for example:
http://www.facebook.com/dialog/feed?app_id=131727613511269&to=287203454659917&redirect_uri=http://www.timeanddate.com/
After clicking share you get the:
Sorry, something went wrong.
We're working on getting this fixed as soon as we can.
Where:
app_id = your app
to = a event / fan page
redirect_uri = a url you are allowed to redirect to
note that the app has publish_stream permissions. (it also has manage_pages for fan pages)
The app in question by the way is: http://apps.facebook.com/tndcountdown/
Thanks,
Andy
EDIT:
An Example taken straight from the documentation:
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=Using%20Dialogs%20to%20interact%20with%20users.&message=Facebook%20Dialogs%20are%20so%20easy!&redirect_uri=http://www.example.com/response&to=287203454659917
just replace to=287203454659917 with an event.. (make a test one like it did there)
A few issues I've run into will dialog is that Facebook tries to fill in any missing data. So if you don't provide a description and caption, Facebook will try to scrape the page to get that content. Depending on how the page responds to the "scraping" Facebook will error out. I always make sure I include at least a space for those fields.
It seems the feed url you provided is similar to what is in the documentation. But the demo in the documentation has extra parameters.
I'm about to add page support to my Facebook app, which does the same thing as yours.
http://apps.facebook.com/countdown-timer/
As I posted here - Facebook Send Button - 'Sorry, something went wrong.'...
I had the same problem & worked out that this was due to linking to a Facebook page that did not have a vanity URL set up (i.e. http://www.facebook.com/CubicMushroom rather than http://www.facebook.com/profile.php?id=261963707177053). If you set up a vanity URL for the page it seems to work OK (providing you link to the vanity URL version of the page URL).
To claim a vanity URL, once you have a certain no of like (it used to be 25, but think it's a little lower now) visit https://www.facebook.com/username/