3 require_once('library/HTML5/Parser.php');
5 function parse_url_content(&$a) {
7 $url = trim($_GET['url']);
9 $template = "<a href=\"%s\" >%s</a>%s";
19 echo sprintf($template,$url,$url,'');
23 $dom = HTML5_Parser::parse($s);
28 $items = $dom->getElementsByTagName('title');
31 foreach($items as $item) {
32 $title = $item->textContent;
37 $items = $dom->getElementsByTagName('p');
39 foreach($items as $item) {
40 $text = $item->textContent;
41 $text = strip_tags($text);
42 if(strlen($text) < 100)
44 $text = substr($text,0,250) . '...' ;
50 $text = '<br />' . $text;
53 echo sprintf($template,$url,$title,$text);