aboutsummaryrefslogtreecommitdiffstats
path: root/include/Scrape.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-01-23 20:09:34 -0800
committerFriendika <info@friendika.com>2011-01-23 20:09:34 -0800
commit5be98e3ec8b0475dc67504967cac695d9e4a129a (patch)
tree50770afdcd94bde11969280db22d00b4c919170e /include/Scrape.php
parent00d2b583588ea1c55e9b478809e8041d6ba98639 (diff)
downloadvolse-hubzilla-5be98e3ec8b0475dc67504967cac695d9e4a129a.tar.gz
volse-hubzilla-5be98e3ec8b0475dc67504967cac695d9e4a129a.tar.bz2
volse-hubzilla-5be98e3ec8b0475dc67504967cac695d9e4a129a.zip
following random feeds
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