I can access facebook page info by going to: https://graph.facebook.com/yorganic.
But the response doesn't contain profile picture.
When i specify the fields to select like the following.. https://graph.facebook.com/yorganic?fields=id,name,picture,were_here_count i can see the picture.
Previously using the first method i was getting the picture but not getting now. Can anyone please tell me whether using the second method is safe or not? and is there any other standard way to do this?
The best you can do is:
First get the Facebook User ID of the user.
Then get the picture with:
https://graph.facebook.com/FACEBOOK_ID/picture
For example: https://graph.facebook.com/100001228933230/picture
EDIT
You don't even need the Facebook ID of the user, you can also use
https://graph.facebook.com/yorganic/picture
You can also use the Graph API Debugger tool for testing:
http://developers.facebook.com/tools/explorer
Related
I just want to put a facebook user profile picture in a simple webpage.
I have read a lot about this, and I found the same answer, "Facebook Api 2.2" cannot query users by username:
http://graph.facebook.com/username
just by user id, but How Can I do this without the api?, I also read that I have to make the user sign into facebook account in order to get the user id, something like that, but it's just a simple webpage.
I was trying to do this in php.
//this is just for showing the page
$homepage = file_get_contents('https://www.facebook.com/ricardo.citerio');
var_dump($homepage);
Here my idea was to get the page and search for this keyword "fb://profile" in the code and catch the first X characters from that point:
fb://profile/621673493
//I can get this by opening the source code of
https://www.facebook.com/ricardo.citerio
but the big issue is that file_get_contents goes to the index page "www.facebook.com" not to "www.facebook.com/username", with any other page works fine but not with facebook.
You can't and shouldn't do it without the API. You must authenticate users in order to use their data. Please read Facebook Platform Policies here: https://developers.facebook.com/policy/
I have a registration plugin embeded via an iframe on my website, The registration plugin works fine , I am also able to get the unique user_id of each user by using the following line of code in the signed_request file which can be located here
The line of code i use to get the user_id is: $response["user_id"];
Now that i have a unique id of each user, i want a way by which i can get the link to the profile image of that user, i know i can get the thumbnail of the profile picutre
using open graph,
But i am looking for a way by which i can get the link to the complete or the original profile picture, not the thumbnail.
Is there a way this can be done? Using open graph or something like that?
You need user_photos permissions first. Then something like this should do it:
SELECT cover_object_id FROM album WHERE owner=me() and type='profile'
Substitute me() with the user you are querying for.
It returns the photo object that you can then use to pull the full version from.
Make an API call to /user_id/?fields=picture using the access_token in the same signed_request
For example, I have http://www.example.com/abc.html.
If I like this page, how can I detect me that have already like this page using facebook php api.
Give me help, please
You can collect who likes your page using the newest facebook sdk. What you would do is a sort of work around using their app interface, which is just a LIKE script for your site, and then call https://graph.facebook.com//subscriptions to record the information via mysql or whatever db you are using. I use this method when collecting facebook invites for random contests I hold.
You can use cookies that must be set in the Like button callback or can use Facebook Connect to check whether a user likes your page but this way requires extra permissions and a created facebook app.
Also there is a ready solution for jquery:
http://codecanyon.net/item/like-2-unlock-for-jquery/2822035
I want to get facebook friends Id of a specific facebook user. how can i do this?
in detail : I have a server, and form a mobile I'll send a facebook id of a user to that server. accoding to that facebook id I want to get facebook ids of friends of that user. (this should do from server) please any one guide me to do that.
answer = for this we should have access token.
Sounds like facebook wouldn't like that :)
You could scan profile.php?id=&sk=friends and parse the output for the ids.
But I'm sure the habe some fancy Ajax running giving you an easier method.
Have you checked their API? https://developers.facebook.com/docs/reference/api/FriendList/
But you need permissions for that.
I have created an app, and now i want to post a message on one of my pages wall with use of the new Graph API. Is this do-able?
below is the steps which i do
Using this to Get access code
https://www.facebook.com/dialog/oauth?client_id=1498653617947&redirect_uri=https://apps.facebook.com/post_on__my_page/index2.html&scope=email,read_stream,publish_stream,manage_pages,offline_access
Than use this to get access token
https://graph.facebook.com/oauth/access_token?client_id=1498653617947&redirect_uri=https://apps.facebook.com/post_on__my_page/index2.html&client_secret=seceret&code=AQDCqJNJnCvnFKVdbCyTp2vfzbT0ADbNgYsQ_2YtDdC_O2aIOwvkjx52HNcp3uiuBANJqOhb_M2sptB-lRrIECZxi5kZpzljez1J1oOtTp25gTnNDmV-RCVvR97DMiRAprNtwUBcstAotjsyYo5cNwJCWnkcgNigwhbQtE5Jp22sluVcZKhnO43cWQE#_=_
Now get page id and page access token from below
https://graph.facebook.com/me/accounts/?access_token=the_access_token_above
*use this to post on my page *
https://graph.facebook.com/1916117518646/feed?message:testmessage&access_token=aceess_token
any one please explain which point is wrong because instead of posting is just show posts details
i found that some thing wrong in this below code any one please suggest what and how to do
https://graph.facebook.com/1916117518646/feed?message:testmessage&access_token=aceess_token
I always highly suggest to people experimenting around for the first time to use the Graph API Explorer tool. It helps solidify the structure of the Graph and how to access it. See https://developers.facebook.com/tools/explorer
Another thing I always recommend is to lint the access_token you are trying to use. See https://developers.facebook.com/tools/lint. This is to ensure you have the right token with the correct permissions.
Also the access_token you use to post to a page must be a page token and not a user token. In your above example, it's unclear as to which one you're using since you've named both the same. I know you said you're using it, but with that variable name being the same, I always wonder.
Also the you need to do an HTTP Post and not an HTTP get to post a message. Again, play around in the graph API explorer until you can do it there. Once you've done it there, it's fairly trivial to do it with one of the SDKs.
You need to perform POST request, not GET, and pass parameters in POST body, not in the url
http://developers.facebook.com/docs/reference/api/user/#posts
http://facebook.stackoverflow.com/questions/691425/how-do-you-post-to-the-wall-on-a-facebook-page-not-profile