Facebook Post : what would replace depreciated parameters since July 17, 2017? - php

If we look at the facebook documentation about POST on the page feed, we notice the following message:
However, it isn't written anywhere by which to replace these parameters, which don't work anymore. Has somebody found it ?
I noticed that by replacing picture by source, we obtained the photo of the article, but for the other parameters I remain in nothingness.

I write this answer to help people who face to this problem.
First, read these article to understand the situation :
Facebook No Longer Allows Custom Link Previews
This announcement by Facebook
They done that to avoid fake news directly posted on pages. They want all the news to be linked to website. So you just have to modify the og:meta (See The Open Graph protocol) in the HTML side.
With the help of the tool "Sharing Debugger", you'll be able to test if your article correctly included the necessary parameters, which were previously entered directly in the PHP.

Related

facebook embeded post with comment

I created a website than can post from my website to facebook using embeded post
https://developers.facebook.com/docs/plugins/embedded-posts
My problem is I need to get all the comment of that certain post.
I've read about the comment plugin
https://developers.facebook.com/docs/plugins/comments
but i don't think that it can solve my problem since it will only give me a comment box for my website, not the comments from their post.
how do I get all the comment of that embeded post? can someone give me a link that might help? thanks.
You have to use the proper Facebook Graph API supplied for web developers to embed and manipulate Facebook content in their applications.
Read the specific documentation here.
EDIT: This is the PHP SDK here and the Reference Documentation, with classes you may use to achieve what you want here. Read it all, understand how to implement it in your project and you'll be up and running.

Facebook Share Dialog Strips Anchor Tags

I've been doing some research and I have yet to find any information that is relevant to what I'm looking for. I've included some links to questions I've already found when they're relevant.
I made a page in WordPress (though the CMS isn't necissarily relevant), and one page has a series of comments. Before each comment, I created an anchor tag, so that if you go to the URL "http://website.com/#10", you'll be brought to the tenth comment. The URL and anchors work fine.
I am now trying to integrate Facebook Share functionality into the site. Specifically, I want to be able to share the URL "http://website.com/#10", with the #10 included, such that a user will be able to share a specific comment on social media and not just the entire comments page.
Following the Facebook Share Dialog example, located here, I crafted a URL that looks like this:
https://www.facebook.com/dialog/share?
app_id=XXXXXXXXXXXXXX
&display=popup
&href=http%3A%2F%2Fwebsite.com%2F%2310
&redirect_uri=XXXXXXXXXXXXXX
With all of the X's filled in with valid information. Note that the "href" parameter is "http%3A%2F%2Fwebsite.com%2F%2310", which is an encoded version of "http://website.com/#10". The "#" symbol is encoded as "%23".
This URL works relatively well for sharing. When I click on it, I'm brought to Facebook, which gives me the same dialog box they show on the Share Dialog developers page. However, after clicking on "Post to Facebook", I find that the actual URL that gets shared is, in fact, "http://website.com/?fb_action_ids=XXXXX&fb_action_types=og.shares". No "#10" anywhere in the URL.
Here's some information on the research I've done, to show that this is a new question (and to remove any repeated answers).
This question asks something quite similar to what I'm asking, and the only answer mentions a way to use Javascript to change all "#" symbols to "%23". However, I have already encoded my URL to do this, so the answer isn't relevant.
This question asks what I believe is a similar question, and the accepted answer basically says that the Share button is deprecated and continues by answering about the Like button. However, while the Share functionality may have once been deprecated, there is a fully working version on developers.facebook.com which I have already linked to. I would like to use this version, but with the ability to share links that include anchor tags.
Does anyone have any advice for how to proceed?
Using dialog does not seems to allow the URL to have #10, as you need.
Instead you may use, for exemple:
https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fwww.terra.com.br%2F%23dia-13&display=popup&ref=plugin;
What can be done is to open a window by javascript, using this URL, where u refers to URL.
So far, there isn't a documentation that describes what parameters can be used with the URL. What is known is that images, title and description may be declared by <meta> tags using og:image, for example, to ensure some default content.
As stated here: http://okaypl.us/blog/facebook-share-dialog-longer-accepts-custom-parameters/
Some old parameters that probably are not working anymore are found in similar questions like:
how to pass parameter like title,summary and image in facebook sharer url.

Unable to download og:image, although it's accessible from withing the debugger

We're a website completely written in PHP, we use facebook metatags since we provide facebook sharing, liking, etc...
problem is when we share a link from our site to facebook, it shows the picture correctly, however trying to reshare the same link from another user, removes the picture and shows the link only.
Further troubleshooting using the FB debug tool shows below error message:
Unable to download og:image‎‎‏: The image referenced by the url of og:image tag could not be downloaded.‎
The weird thing is that the image is already see and accessible in the debugger!!
A sample page:
http://fbcomics.com/home/index/92/date/1462
Debugger for it:
https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Ffbcomics.com%2Fhome%2Findex%2F92%2Fdate%2F1462
Your cooperation is highly appreciated.
I think that you probably need to urlencode() the url value going into the content attribute of your og:image meta tag.
This might be related to a recent Facebook bug. https://developers.facebook.com/bugs/239522122851150
Issue was solved by itself. It seems that Facebook needs sometime (weeks I think) to store the page information including the picture using its crawlers.
If you face this, most probably you'll need to wait for sometime before sharing your new pages.
Thanks,

Facebook link inspector

I'm building a website and am looking for a way to implement a certain feature that Facebook has. The feature that am looking for is the link inspector. I am not sure that is what it is called, or what its called for that matter. It's best I give you an example so you know exactly what I am looking for.
When you post a link on Facebook, for example a link to a youtube video (or any other website for that matter), Facebook automatically inspects the page that it leads you and imports information like page title, favicon, and some other images, and then adds them to your post as a way of giving (what i think is) a brief preview of the page to anyone reading that post.
I already have a feature that allows users to share a link (or URLs). What I want is to do something useful with the url, to display something other than just a plain link to a webpage, to give someone viewing a shared link (in the form if a post) some useful insight into the page that the url leads to.
What I'm looking for is a script, or tutorial, or at the very least someone to point me in the right direction, so that it can help me accomplish this (using PHP preferably).
I've tried googling it but I don't know exactly what such a feature would be called and google isn't helpful when you don't exactly know what you're looking for.
I figure someone out there, in this vast knowledge basket called stackoverflow, can help me with this. Can anyone help me?
You would first scan the page for URLs using regex, then you would parse the pages those links reference with a php DOMDocument. You could use the parsed document to obtain any information you need from the webpage.
DOMDocument:
http://php.net/manual/en/class.domdocument.php
DOMDocument->load (loads a file, aka a webpage):
http://php.net/manual/en/domdocument.load.php
the link goes through http://www.facebook.com/l.php
You pass a URL to this and facebook filters it.

Paste a link and get thumbnails

I want to add a function to my PHP/mysql/jQuery website.
The function is that if user paste a link in a input box,
the server will retrieve all representative pics
just as facebook does.
Is there any PHP code project or jQuery plugin satisfying my demand?
There are lots of services.
Take a look at websnaper for example:
or just google it
It is not hard to write your own from scratch.
Facebook uses the Open Graph Protocol - it retrieves the page and then looks for special meta tags that describe the images associated with that page (og:image).
I guess you can write a basic HTML parser that would do the same.
EDIT: Someone has already written an Open Graph parser

Categories