facebook分享链接脚本

我有一个这样的页面

  mytitle   my data some pics...  data and some pics  

我需要像脚本一样的Facebook分享,所以当任何一个类型的网站url时,这个脚本获取网站标题,图像作为缩略图和身体标签的一些数据..任何想法?

 function getMetaTitle($content){ $pattern = "|<[\s]*title[\s]*>([^<]+)<[\s]*/[\s]*title[\s]*>|Ui"; if(preg_match($pattern, $content, $match)) return $match[1]; else return false; } function getMetaDescription($content) { $metaDescription = false; $metaDescriptionPatterns = array("/]*>/Ui", "/]*>/Ui"); foreach ($metaDescriptionPatterns as $pattern) { if (preg_match($pattern, $content, $match)) $metaDescription = $match[1]; break; } return $metaDescription; } function getExcerpt($content) { $text = html_entity_decode($content); $excerpt = array(); //match all tags preg_match_all("|<[^>]+>(.*)]+>|", $text, $p, PREG_PATTERN_ORDER); for ($x = 0; $x < sizeof($p[0]); $x++) { if (preg_match('< p >i', $p[0][$x])) { $strip = strip_tags($p[0][$x]); if (preg_match("/\./", $strip)) $excerpt[] = $strip; } if (isset($excerpt[0])){ preg_match("/([^.]+.)/", $strip,$matches); return $matches[1]; } } return false; } url = 'http://www.example.com/'; $content = file_get_contents($url); $title = getMetaTitle($content); $description = getMetaDescription($content); $excerpt = getExcerpt($content); print "title: $title "; print "< br />"; print "description: $description "; print "< br />"; print "excerpt: $excerpt"; 
 (.+)<\/title>/i"; preg_match_all($title_regex, $string, $title, PREG_PATTERN_ORDER); $url_title = $title[1]; /// fecth decription $tags = get_meta_tags($url); // fetch images $image_regex = '/]*'.'src=[\"|\'](.*)[\"|\']/Ui'; preg_match_all($image_regex, $string, $img, PREG_PATTERN_ORDER); $images_array = $img[1]; ?> 
= 50 && $height >= 50 ){ echo ""; $k++; } } } } ?>






我希望这个脚本运行良好。

资料来源: http : //www.99points.info/2010/07/facebook-like-extracting-url-data-with-jquery-ajax-php/