How to get a facebook profile picture under https? - facebook

Is it possible to get an facebook profile picture under https using the new Graph API?
We run a site under https, but the profile picture returned by the facebook Graph API is always served as http (when using https://graph.facebook.com/XXX/picture, the request is redirects to http:// ...). The result is the dreaded mixed-content message.
Anybody know of a workaround?

Here is the fix:
you need to the parameter: return_ssl_resources=true
example:
https://graph.facebook.com/FB_UID/picture?return_ssl_resources=true

Use link 1 to get a high resolution image, link 2 to get an icon sized image where 'xxxx' refer to 'facebook_user_id'.
link 1 :
https://graph.facebook.com/xxxx/picture?type=large
link 2 :
https://graph.facebook.com/xxxx/picture?type=small

The Graph API is essentially a very basic API, it's probably not the most efficient method to grab images. A better alternative is to learn how to uSe "FQL" and create a FQL that grabs all the UID's profile pictures. This way, instead of hundred and hundreds of calls, which can be very slow, you grab all the info you need in one call.

Related

Unable to share a picture to facebook using PHP

I've retrieve my page token from developer.facebook.com to share post in a my page using php from script found here: Simple example to post to a Facebook fan page via PHP?
All is ok if I try to post only a text.
Then i tried to include a picture example from a random domain like "http://www.samsung.com/image.jpg". But I get this error:
(#100) Only owners of the URL have the ability to specify the picture, name, thumbnail or description params.
So, i tried to insert a url image from my own domain "http://www.example.com/image.jpg" but I get the same error.
I've completed verification-domain inside business-manager of facebook. then i've linked my fb page "Test" to my domain (always inside business-manager).
Error still remain!
Any suggest?
edit: my test script running on localhost with wamp now
Change the Open Graph Tags of the Page Source if you want to change data like picture, description, ... it is not possible to set them with the API anymore.
More information: https://developers.facebook.com/docs/sharing/webmasters/
Btw, that other thread is from 2011. A lot has changed since then.
Edit: For posting a picture, use this API: https://developers.facebook.com/docs/graph-api/photo-uploads/

Crawl Public Facebook Posts

I made a website where people can post links for other websites and then the backend generates a preview of the link (by using curl and parsing out the open graph tags available on most websites / by picking the first image, html title etc). Now, fine after some tweaking but sometimes I get some kind of rate limit.
Here is one example of a link I want to parse: https://www.facebook.com/HBR/posts/10157131816732787
I can parse it 4 ou 5 times and get a title, image etc but then if I repeat it I get sent to the login page of facebook. How can I avoid this?
I tried to parse the link at https://developers.facebook.com/tools/debug/sharing however it says "Facebook URLs cannot be crawled". So my question is: how am I even supposed to parse those links if they don't even allow it on their debugger?
Is there any kind of API that allows me to get this information without user login? I don't want to parse entire facebook pages, profiles etc, just get a preview for a link that my users might post on the website.
You MUST use the Facebook Graph API if you want to get data of Facebook Pages (or anything else on Facebook), scraping is not allowed.
In order to get data of Pages you do not own, you need to apply for Page Public Content Access: https://developers.facebook.com/docs/apps/review/feature/#reference-PAGES_ACCESS
An App Access Token (without Login) is sufficient in that case.
API Reference for Pages: https://developers.facebook.com/docs/graph-api/reference/page/
I dont think show.You can crawl post on public group using python selenium and beautiful soup

Facebook API - How to post a website link with a custom image?

My goal is to post to my FB page (/{page-id}/feed) a link to a website, choosing the image to show instead of the picture scraped automatically from the web page. The image I'd like to show is not in the web page, so I cannot use the og:image tag.
I'm using the current API (v2.9) and this is what I've tried so far in the Graph API Explorer:
the picture parameter, that does not work as expected (it doesn't replace the automatic image)
picture and link parameters both pointing to the image url, with an action button, but it must have the same url used for the link parameter
the child_attachments parameter, but I need at least 2 images and the final result is quite different, too
additional fields of the link parameter, but thy were removed in the 2.9 API
a lot of combinations between these parameters, with no luck
What am I missing?
For information regarding why it isn't working. I assume they removed it to force users to add it to their website like Twitter did with their Twitter cards and maybe to stop impersonating pages.
https://developers.facebook.com/docs/sharing/reference/feed-dialog#deprecated-params

Is it possible to extract the Facebook Graph url from the image URL?

Basically, I am looking to do the inverse of this question: Getting the "real" Facebook profile picture URL from graph API
So, if this is my image URL:
https://scontent.xx.fbcdn.net/hprofile-xat1/v/t1.0-1/p200x200/1538635_10152313443182867_788243216_n.jpg?oh=72d672bc10ab01386ad5e490c097e059&oe=56A4392D
the design of Facebook's CDN will cause that URL to expire and 404 in the near future. So I am wondering, is it possible to get a URL that will not expire? For the above example, the permanent URL is this:
http://graph.facebook.com/517267866/picture?type=large
which will always 302 to an image URL. I am not sure if this is possible, but any insight would be appreciated.
I also tried looking for a solution in Facebook's Graph API documentation but I couldn't find any reference to this issue. Although I am unfamiliar with the Facebook Graph API, I think posting this question can help others in a similar position.
Update
Here is a slightly different example: How do I find a reliable image URL for the following photo:
https://www.facebook.com/DuwamishTreeCanopy/photos/pb.350520565135304.-2207520000.1444201132./401682256685801/?type=3&theater
?
You cannot "extract" something out of the CDN link... Why don't you just stick with the
https://graph.facebook.com/{user_id}/picture?type=large
link? It should also work without an access token and with app-scoped user ids AFAIK.

Getting facebook profile picture

i need to get the facebook profile picture of anyone by passing their id. But i no need to use facebook API or Graph anything else.. Just i need to give the url with that id.. Is it possible to get the profile picture in this way? I tried in google but i didnt get it. If anyone knows this please respond me...
Well, I think the only options available are:
https://graph.facebook.com/[PROFILE_ID]/picture (You can include this URL inside a tag and it will work).
Scrap yourself the page corresponding to the profile, i.e. http://www.facebook.com/profile.php?id=[PROFILE_ID] and get the URL of the picture there.
I would suggest you to use the first one, because it gives you more flexibility about the picture size (?type=small, ?type=thumbnail, etc).
Edit
Keep in mind that this answer is from 2011, and Facebook makes changes in its APIs frequently.
Apart from using Graph API as already mentioned above (https://graph.facebook.com/[PROFILE_ID]/picture), there are a couple more ways:
FlipTop has a service that pulls up all sorts of information on Facebook users, including direct CDN URLs (e.g. https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/275588_504804917_147319_n.jpg) of profile pictures. (Link to API documentation)
Cloudinary has a similar service, but with hosting thrown in the mix. They do require you to open an account, but it's free. Then you can use their CDN URL format to link to any picture like this: http://res.cloudinary.com/[YOUR_ACCOUNT]/image/facebook/[PROFILE_ID].jpg (Read more here)