Unable to share a picture to facebook using PHP - facebook

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/

Related

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

Facebook Sharing plugin doesn’t detect the specified post URL

I use Facebook share button to share my article (Title, description and image) on Facebook using Open Graph Meta and other default Meta
And my articles are echoed in post.php page like (mywebsite.com/post.php?id=post_id) which contents differ through post_id.
Well, while sharing a post on fb, facing some problems.
1: fb share doesn't detect the image belonging to the article/current post that is shared. (Thought the image URL in my Open Graph Meta is correct) and after sharing it on Facebook the link doesn’t redirect to the exact URL (mywebsite.com/post.php?id=post_id).
2: the fb share button is in my post.php page which shares different posts but sharing is counted same for all posts.
The FB share button has got an attribute (data-href="url-to-share") which my one is (data-href="<?php echo'post.php?id=post_id';?>").
Anyone know what and where is wrong with my code/URL addressing?
If your meta tags shows correct data then must be fb issue. I faced similar problem before.
Try debug your url in the FB debugger( https://developers.facebook.com/tools/debug/og/object/ ). It helps.
Fb haven't grab your updated data because they have their own time/interval to grab new data from the website(if im not mistaken). Using the debugger u'll see how the share will look like and show missing details if any.

Publish app wall share option

I have read a guide for publish link to my wall or my fan page. Here is the guide: net.tutsplus.com/tutorials/php/wrangling-with-the-facebook-graph-api/
This is my application test:
http://www.onlyimagination.com/mytest/source/
The application works, but i don't want GENERATE the link manually, i want only SHARE.
This is the screenshot of the publish of this app
Instead I would just put the link and my application AUTOMATICALLY extracts all the links like this sharing of information here in this screenshot.
The info presented in the 2nd screenshot is just the info of the picture that facebook has.
In order to tell facebook how to present your links you need to use the Open Graph protocol (you can also use the Open Graph docs).
With this protocol you define properties which facebook knows how to extract, such as title, type, image and more.
This means that the response for every link you want people to share on facebook should contain the og meta tags.
Edit
Sorry, did not think about adding this before:
You can use the Debugger tool to see how facebook "sees" urls.
You see, what happens when a user shares a link is that facebook has a program that send a request for the shared link, it then parses the response and search for specific tags to extract the data which is then presented to the user.
For example, try the Debugger for google.com and see what info was extracted, then try to share it and see that it uses the same info.
Also, at the bottom of the Debugger result, there's a link Scraped URL: See exactly what our scraper sees for your URL if you click that you see the actual response.
Hope this clarifies it.
2nd Edit
I don't know how you publish your posts in your app (next time it could be easier if you just add the code you use), but it doesn't matter how you publish it (js sdk or from the server side) you always have two options:
Post a link that has the og meta tags in it, those will tell facebook how to display the link
Add the link, picture, name, caption and description fields when posting (js sdk for client and graph api for server)

facebook like not get the required image

I am creating a facebook like to put on my site. This component will read all posts from a specific page`s wall and display them.
I want to get the required image post on my wall when any user like my page from my website.. I have multiple facebook likes on my page ..
My problem is that when a user like any of the like button it get any image from my page and post it my wall . But i want that it get the specific image and post to my wall..
i also tried to put og:image But no success :-(
Any suggestions please.
You haven't given enough code to diagnose your problems, but assuming that you've followed the open graph instructions on the Facebook Developers site - http://developers.facebook.com/docs/opengraph/ - It would be a good idea pass your target URL through the Facebook Debugger (formerly the URL Linter) it will help show you any errors you have regarding your open graph tagging implementation:
http://developers.facebook.com/tools/debug