ajaxify the wall poster
This commit is contained in:
parent
88bfe21bea
commit
36b66dccb6
8 changed files with 148 additions and 12 deletions
32
mod/parse_url.php
Normal file
32
mod/parse_url.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
require_once('library/HTML5/Parser.php');
|
||||
|
||||
function parse_url_content(&$a) {
|
||||
$url = trim($_GET['url']);
|
||||
|
||||
$template = "<a href=\"%s\" >%s</a>";
|
||||
|
||||
if($url)
|
||||
$s = fetch_url($url);
|
||||
|
||||
if(! $s) {
|
||||
echo sprintf($template,$url,$url);
|
||||
killme();
|
||||
}
|
||||
|
||||
$dom = HTML5_Parser::parse($s);
|
||||
|
||||
if(! $dom)
|
||||
return $ret;
|
||||
|
||||
$items = $dom->getElementsByTagName('title');
|
||||
|
||||
foreach($items as $item) {
|
||||
$title = $item->textContent;
|
||||
break;
|
||||
}
|
||||
|
||||
echo sprintf($template,$url,$title);
|
||||
killme();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue