views:

119

answers:

3

i need to extract data from url like title , description ,and any vedios images in the given url like facebook share button

like this : http://www.facebook.com/sharer.php?u=http://www.wired.com&t=Test

regards

+3  A: 

Use something like cURL to get the page and then something like Simple HTML DOM to parse it and extract the elements you want.

Yacoby
thanx, plz can you also provide me with something work in python also.
islam
A: 

While I was looking for a similar functionality, I came across a jQuery + PHP demo of the url extract feature of Facebook messages: http://www.99points.info/2010/07/facebook-like-extracting-url-data-with-jquery-ajax-php/

Instead of using an HTML DOM parser, it works with simple regular expressions. It looks for title, description and img tags. Hence, the image extraction doesn't perform well with a lot of websites, which use CSS for images. Also, Facebook looks first at its own meta tags and then at the classic description tag of HTML but it illustrates well the principe.

RaphaelO