I’ve been searching about but have found no comprehensive answer, all I want to know is this, when I put a link into Facebook, it generates the title, description and an image for said site – how?
What process takes place for it to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume you mean when you share a link to Facebook. Facebook finds the title in the
<title>tag of the website. The description is either taken from the description meta tag in the HTML document or from text on the website. Since this isn’t completely reliable you are allowed to edit the description before you post the link. I think the same goes for the title.The image is chosen from the images that Facebook can find in the document of the link you’ve provided. You also get to pick which image to use when you’re posting the link, or you can choose not to display an image.
I don’t know any more details about this than what I’ve written above, and I couldn’t find any documentation on the topic either. The above is pretty much what you need to know to use the feature anyway, and to plan any website you plan on being shared on Facebook accordingly.
The technical term for how the extract the data from your link is Web scraping. It’s simply a matter of obtaining the raw HTML if the site you wish to scrape (You can use CURL to do that, or PHP’s file_get_content or a multitude of other ways) then searching for the data you with to extract.
Extracting the title is easy. If you were to use Regular Expressions, you could write one that fetches the content between the
<title></title>tags of the website, here is a simple example:(?<=(\<title\>))(.*)(?=</title>)Similar Regular Expressions can be used to find all image links on the site, as well as sample content.