i need to get the user's facebook url (the one of his own facebook page), eg:
https://www.facebook.com/xxxxxxxx.
i don't know if this is always given by facebook, for me it's the same as the part of my email address lying on the left of the "#"
xxxxxxxx#gmail.com
(i don't know if this can be as UUI..).
i don't need to show any code, how to meet quality standards if i just need to ask this simple question ?
the user fb url can be gotten by using this url : http://facebook.com/profile.php?id= see : https://stackoverflow.com/a/12827922/1705922
Related
For the most part, using the graph api, passing in a Facebook page's encoded URL returns the normal facebook id.
For instance, using the Graph API Explorer and passing in https%3A%2F%2Fwww.facebook.com%2Fkendalljenner returns
{
"name": "Kendall Jenner",
"id": "173567062703796"
}
However, for some (pretty rare) FB pages, like http%3A%2F%2Fwww.facebook.com%2Fmargotrobbie, I get
{ "id": "http://www.facebook.com/margotrobbie" }
The question, Why do some Facebook urls not return their Facebook page id through graph api?, suggests that the issue may be that the page is restricted somehow (like for alcohol content). I believe this may be the case, because the Harley Quinn videos in the posts are a bit graphic, but I searched all the info for the page and it doesn't say anything about the content being restricted. In addition, I am using a User access token that is allowed to see the page via normal FB web interface without any apparent restriction.
BTW, for anyone who hasn't seen this before, the id set to the url seems to be the result when facebook doesn't know anything about the URL. Obviously this shouldn't be the case for facebook's own URL.
Not sure what the reason for the apparent difference with the two page URLs indicated, but I did solve the underlying problem of getting the facebook id of the page!
First of all, I had tried the process described here: How to get page id of facebook page, however it wasn't working for me. In my effort to permute all options, I had changed the access token to a "user access token". Turns out, you HAVE to have an "application access token" as is well-documented in said article.
Thanks to CBroe for making me question how I was calling the API...no matter how long I was calling it this way.
I would like to know If it's possible to add a Check in on Facebook with PHP but without any Page id.
Because I have a database with a lot of places but I do not have a corresponding Facebook Page Id.
ANy idea?
To my knowledge, it is not possible to do a Check In without a page_id.
You can refer to How to get place_id before checkin? to find out how to get Facebook Page Id for your places.
It's not clear in the documentation how you can access the likes of a page. I know i can access my likes easily, but a client of mine would like us to be able to read all the likes each 5 minutes for example and detect who is the 2000th liker.
The problem is that i can't even seem to understand how to get an access token to a specific page.
My understanding although still very obscure to me would be that i need to create an app that asks for this user to authenticate as the page and authorize the app to get the likes of that page?
Am i right?
When responding, can you please provide a basic code base to understand how to do it, i've done 1 facebook login so far and it was hell...
Thanks
UPDATE
Important, when i'm talking about a page, i'm talking about a facebook page, not an external page on the web. The exact page i'm looking to get the likes from is:
http://www.facebook.com/starfrit
getting the actual like for any given page is easy, but you cant find out which user gave them. (or in which order)
$result = $facebook->api(array(
'method' => 'fql.query',
'query' => 'select fan_count from page where page_id = 140812822635148;'
));
or without api:
http://graph.facebook.com/140812822635148
or for an external url:
http://graph.facebook.com/http://www.redbull.com
I am using using ColdFusion 9.0.1
I am building a site that will use Facebook connections extensively, so we need the Facebook one click sign on. Specifically, to vote on our site, visitors will just "log in with Facebook" and can do all sorts of cools things while we track what they do using their email address.
I am only slightly confused by the Facebook documentation. And with their recent security change, most of the tutorials and help files I find elsewhere are out of date. So....
I have the single click sign on form on my page. When I am logged out of Facebook, I can use the "log into Facebook" link on my site to log in to my site as well as Facebook. So, I know the form works and the cookie works too.
From what I understand, I am supposed to read the cookie that Facebook sets in the browser and then parse it to access the info I need. Here's the cookie for my site:
cookie.fbsr_252075631496861
When I CFDUMP this cookie, here's what I get:
P2Hlk0UVT2EXc8LiaH48vmL_gI7Y4mwkto0IoSUN9mI.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNvZGUiOiIyLkFRQ0VLMC1ibzhqeVhJSzYuMzYwMC4xMzI0MzM5MjAwLjEtMTAwMDAwNTg3NDM1OTY1fFNrYkQ1NU9UWndFMTh3cGE4TUZLZkpLalZzdyIsImlzc3VlZF9hdCI6MTMyNDMzNTU2OCwidXNlcl9pZCI6IjEwMDAwMDU4NzQzNTk2NSJ9
I have found a few tutorials on how to parse this string, but nothing works. I don't really know if I am acessing the right cookie.
Now that the user is logged into my site via Facebook, I just need their FBID to access their info. I believe the FBID is buried in this cryptic string.
Can you provide any help?
Once you get parsed signed_request (stored in your cookie) you can use user_id (which is Facebook User Id) and oauth_token (aka access_token) to get needed info via Graph API or FQL.
OK, apologies for the verbose title. Let me give the background in a bit more detail.
My website allows my registered users to create new pages, each of which has its own unique URL. Each page has a Facebook "Like" button on it. I've already implemented Facebook Open Graph API meta tags so that the pages are proper open graph objects, and when some other visiting Facebook user "likes" the registered user's page, a post appears on that Facebook user's wall saying they have liked the page. The Facebook Like widget also displays the number of "likes" that page has received as normal. So far, so good.
What I want to do is allow my registered users to be able to communicate back to the Facebook users who have liked their page. The community of "likers" for a page is a potentially valuable social media resource to the registered user, if only they could communicate back.
I am aware of the "admin page" link you get beside the Like button, which can be used to post to these people, but that is not an option for my registered users as they have no privileges in relation to the Like button.
What I want to do, if possible, is setup a form to capture the registered user's message back to the Facebook users, and then my website sends the message on their behalf, without having to ask for any extra privileges from the Facebook users.
The following Facebook documentation pages seem to say this is possible, but having followed the Open Graph API documentation, I can't get it to work as described - http://developers.facebook.com/blog/post/465/ and http://developers.facebook.com/docs/reference/api/ ("Publishing" subsection). I can get the access token correctly in the first request, and plug that into the second request to do the post, but that doesn't seem to do anything and doesn't return any error.
Since it doesn't work for me, I'm wondering if this is possible as described, or do I need to get some sort of extra permission to do this? I've seen reference to offline_access permission but as I'm new to this stuff I am not sure how it would fit in. If I have to get the Facebook users to grant permissions, this is not going to work as envisaged.
Any thoughts would be most helpful.
The short answer: No, You will never been able to post on someones wall as another user.
The long answer:
You could try to ask for offline access but then you are asking the user to hand over all their facebook data and give you access todo whatever you like their accound, so that is not likely to happend.
The next problem is that they have to be friends to be able to post on each others walls.
Thats why Pages was implemented, so that organisations could announce/talk with the people interested.
However if you have created the like button correctly and give the pages correct meta data, you are able to post to user who have liked it.
Scroll down to Publishing:
http://developers.facebook.com/docs/opengraph/
Just add a form for your user and let your system publish to the correct page, you probably will need a offline token from your own account or similar to use on the server.
Another more complex way could be to generate a facebook page for each page you have on your server.
When the user creates a page on your system a page is created on facebook but as your app as admin.
And when another user likes the page they like the facebook page, hence you have the possibility to post in that page and speak to the user who liked it. (whooa thats a mouthfull).