aboutsummaryrefslogtreecommitdiffstats
path: root/mod/parse_url.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-22 22:41:45 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-22 22:41:45 -0700
commit36b66dccb60a7d65724da542f9d7a2d6722fc6aa (patch)
treec44dd1fae5d16c393b789ca814e31b4c90f4ce55 /mod/parse_url.php
parent88bfe21bead769c3ba81e181b79f9d6426ace351 (diff)
downloadvolse-hubzilla-36b66dccb60a7d65724da542f9d7a2d6722fc6aa.tar.gz
volse-hubzilla-36b66dccb60a7d65724da542f9d7a2d6722fc6aa.tar.bz2
volse-hubzilla-36b66dccb60a7d65724da542f9d7a2d6722fc6aa.zip
ajaxify the wall poster
Diffstat (limited to 'mod/parse_url.php')
-rw-r--r--mod/parse_url.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/mod/parse_url.php b/mod/parse_url.php
new file mode 100644
index 000000000..33381a0d2
--- /dev/null
+++ b/mod/parse_url.php
@@ -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();
+} \ No newline at end of file