aboutsummaryrefslogtreecommitdiffstats
path: root/include/Scrape.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/Scrape.php')
-rw-r--r--include/Scrape.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index cc5015165..b4a5dd849 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -76,5 +76,29 @@ function validate_dfrn($a) {
return $errors;
}}
+if(! function_exists('scrape_meta')) {
+function scrape_meta($url) {
+ $ret = array();
+ $s = fetch_url($url);
+
+ if(! $s)
+ return $ret;
+
+ $dom = HTML5_Parser::parse($s);
+
+ if(! $dom)
+ return $ret;
+ $items = $dom->getElementsByTagName('meta');
+
+ // get DFRN link elements
+
+ foreach($items as $item) {
+ $x = $item->getAttribute('name');
+ if(substr($x,0,5) == "dfrn-")
+ $ret[$x] = $item->getAttribute('content');
+ }
+
+ return $ret;
+}}