is there any way to get facebook APP ID from facebook Fane Page ID?
I've facebook fan page id and now i want to get facebook AppId. please tell me if there is a way or it is possible??
Thanks
It's not possible to get an AppId from a fanpage because fanpages are not Apps, therefore they dont have App Ids.
Perhaps you are thinking of a Page Tab App, and still you can't get it's Id just by having the id of the page the App is in.
Tip: Explaining what you are trying to achieve might help people understand the problem you are having.
i want to get who like facebook post then and store it in php variable ... then look for specific name i want
if it is about facebook photo i can use this
$url = 'graph.facebook.com/photoid'
and then i use the code
file_get_contents($url);
and then search about the name who liked the photo
but in post there is no graph to get who like post
i tried to put the whole link like
$url = 'https://www.facebook.com/AmrKhaled/posts/10152183719946165'
and then i use the code
file_get_contents($url);
but not found the name ... and if i var_dump($filegetcontent) and search my self no name is found
i need to know who like my post by php code ?? thanks
The problem is not the user agent because you shouldn't be scraping the page.
The id in that post is at the end
http://graph.facebook.com/10152183719946165
You just need a valid access token to retrieve it.
To read a Page you need:
an app or user access token for public and non-demographically restricted pages
a user access_token for restricted pages that the current user is able to view (no special permissions required)
I wonder if someone can answer this;
I have a canvas app, which in turn allows the user of the app to attach another app into their page tab. Everything works great. The page tab is now running from the users account.
If a 'Viewer' interacts with that app on the users page tab, i know I cannot get their user id, but how can I get the actual URL of that page they are on, so I can update Pinterest for the 'Viewer'.
Some people state that I need to access the signed request and some say the graph for the Page ID. Which one is the correct way to get the Page ID, or does it even matter ?
Thank you
Take in account that your app always will receive the signed_request var from FB. So why don't use it? Using php-sdk you can obtain it like this:
$signed_request = $facebook->getSignedRequest();
// so for the page ID you do:
$page_id = $signed_request['page']['id'];
I have created my fan page using Page Tab.
Now I want to display visitor Full Name on that page.
Example : Hello Fullname
It's possible without authentication?
I suggest using the Javascript SDK to achieve this, here's the documentation
... and in answer to your second question, you'll need to get authorisation of use user for your app to make any Graph API request.
You'll need to get the user's name by doing an API request to /me?fields=name get the username.
I want to display a different message if a user is currently logged in to facebook and likes the current page. I understand:
FB.Event.subscribe('edge.create', function(response) {
// you like this
});
Which will fire when a user likes the page, but when you reload the page how do you determine they already like the current page?
Thanks!
I'm pretty sure you cant do what you want (in this context).
Take a look at this page : http://fbrell.com/fb.api/does-like
You'll see you need the user to approve a permission to view the likes.
It's a huge security risk to allow someone to see the 'likes' of a user - even for the current page. Think about it you can easily spoof the current page and pretend to be any page.
BUT...
What I recommend you do is just set a cookie for your own benefit (in javascript) when the user 'Likes' your page. Assuming you're getting a large percentage of your 'Likes' from this page then you can safely correlate the presence of the cookie with a 'Like'.
I've seen some security exceptions doing this, but it seems to work (at least in Chrome).
Sense you describe the page as "current page" I understand that it is in an iframe tab. If this is the case, signed request supplies you with that information as $decode_signed_request = array('page' => array('liked' => true/false)).
Otherwise you can supply a canvas page with the GET parameters fb_page_id, which should include the parameter fb_sig_added to the server request with a 0/1 depending on if the user is a fan of that page. (This may require disabling OAuth 2.0 in your migration settings)
If you are talking about the like social plugin with an open graph url, you can not readily find out if the user is a fan without an application installation. If you do have that you can do an api call to /me/likes which will return a list of all the likes that user has, and search for the id of the object you are testing for.
You're safer using the Graph API since Facebook is in the process of deprecating their REST API. So to get if a user likes your page, you will need the page ID and the access token of your app.
https://graph.facebook.com/me/likes/PAGE_ID?format=json&access_token=ACCESS_TOKEN
Where PAGE_ID is the page id you want to check.
and ACCESS_TOKEN is your apps access token.
From the Graph API you can get the likes of a user by his id, as:
https://graph.facebook.com/ID/CONNECTION_TYPE
so for getting the likes you put your access token and:
https://graph.facebook.com/me/likes?access_token=2222222222222222
then look for your page if it is liked or not.
However you can always try FQL queries which i didnt try for Likes actually.
I hope that helped.
save user id or third_party_id in database when the user liked the link
to Get third_party_id
graph.facebook.com/me/?fields=third_party_id&access_token=xxx
https://graph.facebook.com/{FB_USER_ID}?fields=likes.target_id(167584559969748)&access_token={VALID_ACCESS_TOKEN}
shows data if that user has liked that Facebook fan page.
or
https://graph.facebook.com/{FB_USER_ID}?fields=likes.fields(link)
shows a list of liked links, from where you can get the link you are looking for.
All of these need 'user_likes' and/or friend_likes permissions.