aboutsummaryrefslogtreecommitdiffstats
path: root/include/Scrape.php
diff options
context:
space:
mode:
authorroot <root@diekershoff.homeunix.net>2011-01-24 07:44:08 +0100
committerroot <root@diekershoff.homeunix.net>2011-01-24 07:44:08 +0100
commit80a7e68528e7a4d95c168889f1a2fb9eccf6e3b9 (patch)
tree5a59cf3b29a70f22728e25d7c46ab8648bcda407 /include/Scrape.php
parent71294faf2c182a678e5889b2ff9cabed16d83c82 (diff)
parent4198efe03570606b35f3aba6cdf7f80de20384f4 (diff)
downloadvolse-hubzilla-80a7e68528e7a4d95c168889f1a2fb9eccf6e3b9.tar.gz
volse-hubzilla-80a7e68528e7a4d95c168889f1a2fb9eccf6e3b9.tar.bz2
volse-hubzilla-80a7e68528e7a4d95c168889f1a2fb9eccf6e3b9.zip
Merge branch 'master' of git://github.com/tobiasd/friendika
Diffstat (limited to 'include/Scrape.php')
-rw-r--r--include/Scrape.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/Scrape.php b/include/Scrape.php
index 10ec54d13..8478ea407 100644
--- a/include/Scrape.php
+++ b/include/Scrape.php
@@ -22,6 +22,8 @@ function scrape_dfrn($url) {
foreach($items as $item) {
$x = $item->getAttribute('rel');
+ if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml'))
+ $ret['feed_atom'] = $item->getAttribute('href');
if(substr($x,0,5) == "dfrn-")
$ret[$x] = $item->getAttribute('href');
if($x === 'lrdd') {
@@ -135,3 +137,31 @@ function scrape_vcard($url) {
return $ret;
}}
+
+
+if(! function_exists('scrape_feed')) {
+function scrape_feed($url) {
+
+ $ret = array();
+ $s = fetch_url($url);
+
+ if(! $s)
+ return $ret;
+
+ $dom = HTML5_Parser::parse($s);
+
+ if(! $dom)
+ return $ret;
+
+ $items = $dom->getElementsByTagName('link');
+
+ // get Atom link elements
+
+ foreach($items as $item) {
+ $x = $item->getAttribute('rel');
+ if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml'))
+ $ret['feed_atom'] = $item->getAttribute('href');
+ }
+
+ return $ret;
+}} \ No newline at end of file