How to get from the link the name of the site, its description and so forth. ?

How do all these big social networks?

  • jQuery.load can pull out a specific element, or elements - Grundy
  • But not from external pages - stsdc
  • What means not from external pages? - Grundy
  • I mean from other sites, not from my server - stsdc
  • It doesn’t matter here, it’sn’t the usual overgrown - Grundy

1 answer 1

These "big social networks" check each link and download meta information on it.

Here, for example, the meta of this page

<meta property="og:type" content="website" /> <meta property="og:image" itemprop="image primaryImageOfPage" content="http://cdn.sstatic.net/ru/img/apple-touch-icon@2.png?v=bc20db47c743&a" /> <meta property="og:title" itemprop="title name" content="Как из ссылки вытянуть мета теги?" /> <meta property="og:description" itemprop="description" content="Как достать из ссылки название сайта, его описание итп. ? Как это делают все эти большие соцсети ?" /> 

And if these meta tags are not registered on the indicated link, then nothing big "big social networks" will be pulled out of the page.

This is called the Open Graph Protocol.
Read here: http://ogp.me/

  • Well, VC even without opengraph pulls some data from the link. I wonder, is it available to mere ignorant mortals? - stsdc 5:53
  • VK guess ... Parsyt page and try to analyze its content. Most of the pages, for example, have the right <title> ... Simple mortals can do it too. You need to read what is cURL ( php.net/curl ). In a nutshell: your code “enters” the page, reads its source (this is like the browser’s page view source) and analyzes the data received. Searches for these meta and uses them. Here, on RU.SO, there are a lot of questions and answers to these topics. - cyadvert
  • I am interested in whether this can be done on the client side? - stsdc
  • What is meant by "client side"? Although in theory, nothing prevents you from doing ajax requests that pull out the information you need ... - cyadvert