When you type a URL into facebook, it automatically comes up with the \"post a link\" feature. With most websites, it automatically loads a selection of images it pulls from som
I think following steps are involved
og:title
if missing from
og:description
if missing from
og:image
if missing from
curl
or file_get_contents
and parse for required data detailed above. Not sure about other Language.Additionally I think FB stores the data, once found, in database and 1st queries there. This helps them to get faster result and hence same article shared and liked generate the image and details from the stored data.
You will need Javascript to show this preview in runtime (while you write in the textarea). However if you only need it after posting of data it can be done with pure server side language (you can avoid javascript) and following above steps just remove AJAX call.