X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FScrape.php;h=8478ea40714d389365522d02d685c7befbe51307;hb=80a7e68528e7a4d95c168889f1a2fb9eccf6e3b9;hp=10ec54d1347aa968ec35c3d9b1b9185ca61976dc;hpb=c16f314ec348205f4741e0171335168720e652d2;p=friendica.git diff --git a/include/Scrape.php b/include/Scrape.php index 10ec54d134..8478ea4071 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