From 6348e70daa113e8b3203de8fbc919d08c90d972e Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Thu, 1 Jul 2010 16:48:07 -0700 Subject: Initial checkin --- include/Scrape.php | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 include/Scrape.php (limited to 'include/Scrape.php') diff --git a/include/Scrape.php b/include/Scrape.php new file mode 100644 index 000000000..cc5015165 --- /dev/null +++ b/include/Scrape.php @@ -0,0 +1,80 @@ +getElementsByTagName('link'); + + // get DFRN link elements + + foreach($items as $item) { + $x = $item->getAttribute('rel'); + if(substr($x,0,5) == "dfrn-") + $ret[$x] = $item->getAttribute('href'); + } + + // Pull out hCard profile elements + + $items = $dom->getElementsByTagName('*'); + foreach($items as $item) { + if(attribute_contains($item->getAttribute('class'), 'vcard')) { + $level2 = $item->getElementsByTagName('*'); + foreach($level2 as $x) { + if(attribute_contains($x->getAttribute('class'),'fn')) + $ret['fn'] = $x->textContent; + if(attribute_contains($x->getAttribute('class'),'photo')) + $ret['photo'] = $x->getAttribute('src'); + if(attribute_contains($x->getAttribute('class'),'key')) + $ret['key'] = $x->textContent; + } + } + } + + return $ret; +}} + + + + + + +if(! function_exists('validate_dfrn')) { +function validate_dfrn($a) { + $errors = 0; + if(! x($a,'key')) + $errors ++; + if(! x($a,'dfrn-request')) + $errors ++; + if(! x($a,'dfrn-confirm')) + $errors ++; + if(! x($a,'dfrn-notify')) + $errors ++; + if(! x($a,'dfrn-poll')) + $errors ++; + return $errors; +}} + + + -- cgit v1.2.3