]> git.mxchange.org Git - friendica.git/blob - include/Scrape.php
Merge pull request #155 from tobiasd/master
[friendica.git] / include / Scrape.php
1 <?php
2
3 require_once('library/HTML5/Parser.php');
4 require_once('include/crypto.php');
5
6 if(! function_exists('scrape_dfrn')) {
7 function scrape_dfrn($url) {
8
9         $a = get_app();
10
11         $ret = array();
12
13         logger('scrape_dfrn: url=' . $url);
14
15         $s = fetch_url($url);
16
17         if(! $s) 
18                 return $ret;
19
20         $headers = $a->get_curl_headers();
21         logger('scrape_dfrn: headers=' . $headers, LOGGER_DEBUG);
22
23
24         $lines = explode("\n",$headers);
25         if(count($lines)) {
26                 foreach($lines as $line) {                              
27                         // don't try and run feeds through the html5 parser
28                         if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
29                                 return ret;
30                 }
31         }
32
33
34         $dom = HTML5_Parser::parse($s);
35
36         if(! $dom)
37                 return $ret;
38
39         $items = $dom->getElementsByTagName('link');
40
41         // get DFRN link elements
42
43         foreach($items as $item) {
44                 $x = $item->getAttribute('rel');
45                 if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml'))
46                         $ret['feed_atom'] = $item->getAttribute('href');
47                 if(substr($x,0,5) == "dfrn-") {
48                         $ret[$x] = $item->getAttribute('href');
49                 }
50                 if($x === 'lrdd') {
51                         $decoded = urldecode($item->getAttribute('href'));
52                         if(preg_match('/acct:([^@]*)@/',$decoded,$matches))
53                                 $ret['nick'] = $matches[1];
54                 }
55         }
56
57         // Pull out hCard profile elements
58
59         $largest_photo = 0;
60
61         $items = $dom->getElementsByTagName('*');
62         foreach($items as $item) {
63                 if(attribute_contains($item->getAttribute('class'), 'vcard')) {
64                         $level2 = $item->getElementsByTagName('*');
65                         foreach($level2 as $x) {
66                                 if(attribute_contains($x->getAttribute('class'),'fn')) {
67                                         $ret['fn'] = $x->textContent;
68                                 }
69                                 if((attribute_contains($x->getAttribute('class'),'photo'))
70                                         || (attribute_contains($x->getAttribute('class'),'avatar'))) {
71                                         $size = intval($x->getAttribute('width'));
72                                         // dfrn prefers 175, so if we find this, we set largest_size so it can't be topped.
73                                         if(($size > $largest_photo) || ($size == 175) || (! $largest_photo)) {
74                                                 $ret['photo'] = $x->getAttribute('src');
75                                                 $largest_photo = (($size == 175) ? 9999 : $size);
76                                         }
77                                 }
78                                 if(attribute_contains($x->getAttribute('class'),'key')) {
79                                         $ret['key'] = $x->textContent;
80                                 }
81                         }
82                 }
83         }
84
85         return $ret;
86 }}
87
88
89
90
91
92
93 if(! function_exists('validate_dfrn')) {
94 function validate_dfrn($a) {
95         $errors = 0;
96         if(! x($a,'key'))
97                 $errors ++;
98         if(! x($a,'dfrn-request'))
99                 $errors ++;
100         if(! x($a,'dfrn-confirm'))
101                 $errors ++;
102         if(! x($a,'dfrn-notify'))
103                 $errors ++;
104         if(! x($a,'dfrn-poll'))
105                 $errors ++;
106         return $errors;
107 }}
108
109 if(! function_exists('scrape_meta')) {
110 function scrape_meta($url) {
111
112         $a = get_app();
113
114         $ret = array();
115
116         logger('scrape_meta: url=' . $url);
117
118         $s = fetch_url($url);
119
120         if(! $s) 
121                 return $ret;
122
123         $headers = $a->get_curl_headers();
124         logger('scrape_meta: headers=' . $headers, LOGGER_DEBUG);
125
126         $lines = explode("\n",$headers);
127         if(count($lines)) {
128                 foreach($lines as $line) {                              
129                         // don't try and run feeds through the html5 parser
130                         if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
131                                 return ret;
132                 }
133         }
134
135
136
137         $dom = HTML5_Parser::parse($s);
138
139         if(! $dom)
140                 return $ret;
141
142         $items = $dom->getElementsByTagName('meta');
143
144         // get DFRN link elements
145
146         foreach($items as $item) {
147                 $x = $item->getAttribute('name');
148                 if(substr($x,0,5) == "dfrn-")
149                         $ret[$x] = $item->getAttribute('content');
150         }
151
152         return $ret;
153 }}
154
155
156 if(! function_exists('scrape_vcard')) {
157 function scrape_vcard($url) {
158
159         $a = get_app();
160
161         $ret = array();
162
163         logger('scrape_vcard: url=' . $url);
164
165         $s = fetch_url($url);
166
167         if(! $s) 
168                 return $ret;
169
170         $headers = $a->get_curl_headers();
171         $lines = explode("\n",$headers);
172         if(count($lines)) {
173                 foreach($lines as $line) {                              
174                         // don't try and run feeds through the html5 parser
175                         if(stristr($line,'content-type:') && ((stristr($line,'application/atom+xml')) || (stristr($line,'application/rss+xml'))))
176                                 return ret;
177                 }
178         }
179
180         $dom = HTML5_Parser::parse($s);
181
182         if(! $dom)
183                 return $ret;
184
185         // Pull out hCard profile elements
186
187         $largest_photo = 0;
188
189         $items = $dom->getElementsByTagName('*');
190         foreach($items as $item) {
191                 if(attribute_contains($item->getAttribute('class'), 'vcard')) {
192                         $level2 = $item->getElementsByTagName('*');
193                         foreach($level2 as $x) {
194                                 if(attribute_contains($x->getAttribute('class'),'fn'))
195                                         $ret['fn'] = $x->textContent;
196                                 if((attribute_contains($x->getAttribute('class'),'photo'))
197                                         || (attribute_contains($x->getAttribute('class'),'avatar'))) {
198                                         $size = intval($x->getAttribute('width'));
199                                         if(($size > $largest_photo) || (! $largest_photo)) {
200                                                 $ret['photo'] = $x->getAttribute('src');
201                                                 $largest_photo = $size;
202                                         }
203                                 }
204                                 if((attribute_contains($x->getAttribute('class'),'nickname'))
205                                         || (attribute_contains($x->getAttribute('class'),'uid'))) {
206                                         $ret['nick'] = $x->textContent;
207                                 }
208                         }
209                 }
210         }
211
212         return $ret;
213 }}
214
215
216 if(! function_exists('scrape_feed')) {
217 function scrape_feed($url) {
218
219         $a = get_app();
220
221         $ret = array();
222         $s = fetch_url($url);
223
224         if(! $s) 
225                 return $ret;
226
227         $headers = $a->get_curl_headers();
228         logger('scrape_feed: headers=' . $headers, LOGGER_DEBUG);
229
230         $lines = explode("\n",$headers);
231         if(count($lines)) {
232                 foreach($lines as $line) {                              
233                         if(stristr($line,'content-type:')) {
234                                 if(stristr($line,'application/atom+xml') || stristr($s,'<feed')) {
235                                         $ret['feed_atom'] = $url;
236                                         return $ret;
237                                 }
238                                 if(stristr($line,'application/rss+xml') || stristr($s,'<rss')) {
239                                         $ret['feed_rss'] = $url;
240                                         return $ret;
241                                 }
242                         }
243                 }
244         }
245
246         $dom = HTML5_Parser::parse($s);
247
248         if(! $dom)
249                 return $ret;
250
251
252         $items = $dom->getElementsByTagName('img');
253
254         // get img elements (twitter)
255
256         if($items) {
257                 foreach($items as $item) {
258                         $x = $item->getAttribute('id');
259                         if($x === 'profile-image') {
260                                 $ret['photo'] = $item->getAttribute('src');
261                         }
262                 }
263         }
264
265
266         $head = $dom->getElementsByTagName('base');
267         if($head) {
268                 foreach($head as $head0) {
269                         $basename = $head0->getAttribute('href');
270                         break;
271                 }
272         }
273         if(! $basename)
274                 $basename = substr($url,0,strrpos($url,'/')) . '/';
275
276         $items = $dom->getElementsByTagName('link');
277
278         // get Atom/RSS link elements, take the first one of either.
279
280         if($items) {
281                 foreach($items as $item) {
282                         $x = $item->getAttribute('rel');
283                         if(($x === 'alternate') && ($item->getAttribute('type') === 'application/atom+xml')) {
284                                 if(! x($ret,'feed_atom'))
285                                         $ret['feed_atom'] = $item->getAttribute('href');
286                         }
287                         if(($x === 'alternate') && ($item->getAttribute('type') === 'application/rss+xml')) {
288                                 if(! x($ret,'feed_rss'))
289                                         $ret['feed_rss'] = $item->getAttribute('href');
290                         }
291                 }       
292         }
293
294         // Drupal and perhaps others only provide relative URL's. Turn them into absolute.
295
296         if(x($ret,'feed_atom') && (! strstr($ret['feed_atom'],'://')))
297                 $ret['feed_atom'] = $basename . $ret['feed_atom'];
298         if(x($ret,'feed_rss') && (! strstr($ret['feed_rss'],'://')))
299                 $ret['feed_rss'] = $basename . $ret['feed_rss'];
300
301         return $ret;
302 }}
303
304
305 /**
306  *
307  * Probe a network address to discover what kind of protocols we need to communicate with it.
308  *
309  * Warning: this function is a bit touchy and there are some subtle dependencies within the logic flow.
310  * Edit with care.
311  *
312  */
313
314 /**
315  *
316  * PROBE_DIASPORA has a bias towards returning Diaspora information
317  * while PROBE_NORMAL has a bias towards dfrn/zot - in the case where
318  * an address (such as a Friendika address) supports more than one type
319  * of network. 
320  *
321  */
322
323
324 define ( 'PROBE_NORMAL',   0);
325 define ( 'PROBE_DIASPORA', 1);
326
327 function probe_url($url, $mode = PROBE_NORMAL) {
328         require_once('include/email.php');
329
330         $result = array();
331
332         if(! $url)
333                 return $result;
334
335         $diaspora = false;
336         $diaspora_base = '';
337         $diaspora_guid = '';    
338         $diaspora_key = '';
339         $email_conversant = false;
340
341         $twitter = ((strpos($url,'twitter.com') !== false) ? true : false);
342
343         $at_addr = ((strpos($url,'@') !== false) ? true : false);
344
345         if(! $twitter) {
346
347                 if(strpos($url,'mailto:') !== false && $at_addr) {
348                         $url = str_replace('mailto:','',$url);
349                         $links = array();
350                 }
351                 else
352                         $links = lrdd($url);
353
354                 if(count($links)) {
355                         logger('probe_url: found lrdd links: ' . print_r($links,true), LOGGER_DATA);
356                         foreach($links as $link) {
357                                 if($link['@attributes']['rel'] === NAMESPACE_ZOT)
358                                         $zot = unamp($link['@attributes']['href']);
359                                 if($link['@attributes']['rel'] === NAMESPACE_DFRN)
360                                         $dfrn = unamp($link['@attributes']['href']);
361                                 if($link['@attributes']['rel'] === 'salmon')
362                                         $notify = unamp($link['@attributes']['href']);
363                                 if($link['@attributes']['rel'] === NAMESPACE_FEED)
364                                         $poll = unamp($link['@attributes']['href']);
365                                 if($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard')
366                                         $hcard = unamp($link['@attributes']['href']);
367                                 if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
368                                         $profile = unamp($link['@attributes']['href']);
369                                 if($link['@attributes']['rel'] === 'http://joindiaspora.com/seed_location') {
370                                         $diaspora_base = unamp($link['@attributes']['href']);
371                                         $diaspora = true;
372                                 }
373                                 if($link['@attributes']['rel'] === 'http://joindiaspora.com/guid') {
374                                         $diaspora_guid = unamp($link['@attributes']['href']);
375                                         $diaspora = true;
376                                 }
377                                 if($link['@attributes']['rel'] === 'diaspora-public-key') {
378                                         $diaspora_key = base64_decode(unamp($link['@attributes']['href']));
379                                         $pubkey = rsatopem($diaspora_key);
380                                         $diaspora = true;
381                                 }
382                         }
383
384                         // Status.Net can have more than one profile URL. We need to match the profile URL
385                         // to a contact on incoming messages to prevent spam, and we won't know which one
386                         // to match. So in case of two, one of them is stored as an alias. Only store URL's
387                         // and not webfinger user@host aliases. If they've got more than two non-email style
388                         // aliases, let's hope we're lucky and get one that matches the feed author-uri because 
389                         // otherwise we're screwed.
390
391                         foreach($links as $link) {
392                                 if($link['@attributes']['rel'] === 'alias') {
393                                         if(strpos($link['@attributes']['href'],'@') === false) {
394                                                 if(isset($profile)) {
395                                                         if($link['@attributes']['href'] !== $profile)
396                                                                 $alias = unamp($link['@attributes']['href']);
397                                                 }
398                                                 else
399                                                         $profile = unamp($link['@attributes']['href']);
400                                         }
401                                 }
402                         }
403                 }
404                 elseif($mode == PROBE_NORMAL) {
405
406                         // Check email
407
408                         $orig_url = $url;
409                         if((strpos($orig_url,'@')) && validate_email($orig_url)) {
410                                 $x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1",
411                                         intval(local_user())
412                                 );
413                                 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
414                                         intval(local_user())
415                                 );
416                                 if(count($x) && count($r)) {
417                                     $mailbox = construct_mailbox_name($r[0]);
418                                         $password = '';
419                                         openssl_private_decrypt(hex2bin($r[0]['pass']),$password,$x[0]['prvkey']);
420                                         $mbox = email_connect($mailbox,$r[0]['user'],$password);
421                                         unset($password);
422                                 }
423                                 if($mbox) {
424                                         $msgs = email_poll($mbox,$orig_url);
425                                         if(count($msgs)) {
426                                                 $addr = $orig_url;
427                                                 $network = NETWORK_MAIL;
428                                                 $name = substr($url,0,strpos($url,'@'));
429                                                 $profile = 'http://' . substr($url,strpos($url,'@')+1);
430                                                 // fix nick character range
431                                                 $vcard = array('fn' => $name, 'nick' => $name, 'photo' => gravatar_img($url));
432                                                 $notify = 'smtp ' . random_string();
433                                                 $poll = 'email ' . random_string();
434                                                 $priority = 0;
435                                                 $x = email_msg_meta($mbox,$msgs[0]);
436                                                 if(stristr($x->from,$orig_url))
437                                                         $adr = imap_rfc822_parse_adrlist($x->from,'');
438                                                 elseif(stristr($x->to,$orig_url))
439                                                         $adr = imap_rfc822_parse_adrlist($x->to,'');
440                                                 if(isset($adr) && strlen($adr[0]->personal))
441                                                         $vcard['fn'] = notags($adr[0]->personal);
442                                         }
443                                         imap_close($mbox);
444                                 }
445                         }
446                 }
447         }       
448
449         if($mode == PROBE_NORMAL) {
450                 if(strlen($zot)) {
451                         $s = fetch_url($zot);
452                         if($s) {
453                                 $j = json_decode($s);
454                                 if($j) {
455                                         $network = NETWORK_ZOT;
456                                         $vcard   = array(
457                                                 'fn'    => $j->fullname, 
458                                                 'nick'  => $j->nickname, 
459                                                 'photo' => $j->photo
460                                         );
461                                         $profile  = $j->url;
462                                         $notify   = $j->post;
463                                         $pubkey   = $j->pubkey;
464                                         $poll     = 'N/A';
465                                 }
466                         }
467                 }
468
469                 if(strlen($dfrn)) {
470                         $ret = scrape_dfrn($dfrn);
471                         if(is_array($ret) && x($ret,'dfrn-request')) {
472                                 $network = NETWORK_DFRN;
473                                 $request = $ret['dfrn-request'];
474                                 $confirm = $ret['dfrn-confirm'];
475                                 $notify  = $ret['dfrn-notify'];
476                                 $poll    = $ret['dfrn-poll'];
477
478                                 $vcard = array();
479                                 $vcard['fn'] = $ret['fn'];
480                                 $vcard['nick'] = $ret['nick'];
481                                 $vcard['photo'] = $ret['photo'];
482                         }
483                 }
484         }
485
486         if($diaspora && $diaspora_base && $diaspora_guid) {
487                 if($mode == PROBE_DIASPORA || ! $notify)
488                         $notify = $diaspora_base . 'receive/post/' . $diaspora_guid;
489                 if(strpos($url,'@'))
490                         $addr = str_replace('acct:', '', $url);
491         }                       
492
493         if($network !== NETWORK_ZOT && $network !== NETWORK_DFRN && $network !== NETWORK_MAIL) {
494                 if($diaspora)
495                         $network = NETWORK_DIASPORA;
496                 else
497                         $network  = NETWORK_OSTATUS;
498                 $priority = 0;
499
500                 if($hcard && ! $vcard) {
501                         $vcard = scrape_vcard($hcard);
502
503                         // Google doesn't use absolute url in profile photos
504         
505                         if((x($vcard,'photo')) && substr($vcard['photo'],0,1) == '/') {
506                                 $h = @parse_url($hcard);
507                                 if($h)
508                                         $vcard['photo'] = $h['scheme'] . '://' . $h['host'] . $vcard['photo'];
509                         }
510                 
511                         logger('probe_url: scrape_vcard: ' . print_r($vcard,true), LOGGER_DATA);
512                 }
513
514                 if($twitter) {          
515                         logger('twitter: setup');
516                         $tid = basename($url);
517                         $tapi = 'https://api.twitter.com/1/statuses/user_timeline.rss';
518                         if(intval($tid))
519                                 $poll = $tapi . '?user_id=' . $tid;
520                         else
521                                 $poll = $tapi . '?screen_name=' . $tid;
522                         $profile = 'http://twitter.com/#!/' . $tid;
523                 }
524
525                 if(! x($vcard,'fn'))
526                         if(x($vcard,'nick'))
527                                 $vcard['fn'] = $vcard['nick'];
528
529                 $check_feed = false;
530
531                 if($twitter || ! $poll)
532                         $check_feed = true;
533                 if((! isset($vcard)) || (! $profile))
534                         $check_feed = true;
535                 if(($at_addr) && (! count($links)))
536                         $check_feed = false;
537
538                 if($check_feed) {
539
540                         $feedret = scrape_feed(($poll) ? $poll : $url);
541                         logger('probe_url: scrape_feed returns: ' . print_r($feedret,true), LOGGER_DATA);
542                         if(count($feedret) && ($feedret['feed_atom'] || $feedret['feed_rss'])) {
543                                 $poll = ((x($feedret,'feed_atom')) ? unamp($feedret['feed_atom']) : unamp($feedret['feed_rss']));
544                                 if(! x($vcard)) 
545                                         $vcard = array();
546                         }
547
548                         if(x($feedret,'photo') && (! x($vcard,'photo')))
549                                 $vcard['photo'] = $feedret['photo'];
550                         require_once('library/simplepie/simplepie.inc');
551                     $feed = new SimplePie();
552                         $xml = fetch_url($poll);
553
554                         logger('probe_url: fetch feed: ' . $poll . ' returns: ' . $xml, LOGGER_DATA);
555                         $a = get_app();
556
557                         logger('probe_url: scrape_feed: headers: ' . $a->get_curl_headers(), $LOGGER_DATA);
558
559                         $feed->set_raw_data($xml);
560
561                     $feed->init();
562                         if($feed->error())
563                                 logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
564
565
566                         if(! x($vcard,'photo'))
567                                 $vcard['photo'] = $feed->get_image_url();
568                         $author = $feed->get_author();
569
570                         if($author) {                   
571                                 $vcard['fn'] = unxmlify(trim($author->get_name()));
572                                 if(! $vcard['fn'])
573                                         $vcard['fn'] = trim(unxmlify($author->get_email()));
574                                 if(strpos($vcard['fn'],'@') !== false)
575                                         $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
576                                 $email = unxmlify($author->get_email());
577                                 if(! $profile && $author->get_link())
578                                         $profile = trim(unxmlify($author->get_link()));
579                                 if(! $vcard['photo']) {
580                                         $rawtags = $feed->get_feed_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
581                                 if($rawtags) {
582                                                 $elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
583                                                 if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
584                                                         $vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
585                                 }
586                                 }
587                         }
588                         else {
589                                 $item = $feed->get_item(0);
590                                 if($item) {
591                                         $author = $item->get_author();
592                                         if($author) {                   
593                                                 $vcard['fn'] = trim(unxmlify($author->get_name()));
594                                                 if(! $vcard['fn'])
595                                                         $vcard['fn'] = trim(unxmlify($author->get_email()));
596                                                 if(strpos($vcard['fn'],'@') !== false)
597                                                         $vcard['fn'] = substr($vcard['fn'],0,strpos($vcard['fn'],'@'));
598                                                 $email = unxmlify($author->get_email());
599                                                 if(! $profile && $author->get_link())
600                                                         $profile = trim(unxmlify($author->get_link()));
601                                         }
602                                         if(! $vcard['photo']) {
603                                                 $rawmedia = $item->get_item_tags('http://search.yahoo.com/mrss/','thumbnail');
604                                                 if($rawmedia && $rawmedia[0]['attribs']['']['url'])
605                                                         $vcard['photo'] = unxmlify($rawmedia[0]['attribs']['']['url']);
606                                         }
607                                         if(! $vcard['photo']) {
608                                                 $rawtags = $item->get_item_tags( SIMPLEPIE_NAMESPACE_ATOM_10, 'author');
609                                         if($rawtags) {
610                                                         $elems = $rawtags[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10];
611                                                         if((x($elems,'link')) && ($elems['link'][0]['attribs']['']['rel'] === 'photo'))
612                                                                 $vcard['photo'] = $elems['link'][0]['attribs']['']['href'];
613                                         }
614                                         }
615                                 }
616                         }
617
618                         if((! $vcard['photo']) && strlen($email))
619                                 $vcard['photo'] = gravatar_img($email);
620                         if($poll === $profile)
621                                 $lnk = $feed->get_permalink();
622                         if(isset($lnk) && strlen($lnk))
623                                 $profile = $lnk;        
624
625                         if(! (x($vcard,'fn')))
626                                 $vcard['fn'] = notags($feed->get_title());
627                         if(! (x($vcard,'fn')))
628                                 $vcard['fn'] = notags($feed->get_description());
629
630                         if(strpos($vcard['fn'],'Twitter / ') !== false) {
631                                 $vcard['fn'] = substr($vcard['fn'],strpos($vcard['fn'],'/')+1);
632                                 $vcard['fn'] = trim($vcard['fn']);
633                         }
634                         if(! x($vcard,'nick')) {
635                                 $vcard['nick'] = strtolower(notags(unxmlify($vcard['fn'])));
636                                 if(strpos($vcard['nick'],' '))
637                                         $vcard['nick'] = trim(substr($vcard['nick'],0,strpos($vcard['nick'],' ')));
638                         }
639                         if(! $network)
640                                 $network = 'feed';
641                         if(! $priority)
642                                 $priority = 2;
643                 }
644         }
645
646         if(! x($vcard,'photo')) {
647                 $a = get_app();
648                 $vcard['photo'] = $a->get_baseurl() . '/images/default-profile.jpg' ; 
649         }
650
651         if(! $profile)
652                 $profile = $url;
653
654         $vcard['fn'] = notags($vcard['fn']);
655         $vcard['nick'] = str_replace(' ','',notags($vcard['nick']));
656
657
658         $result['name'] = $vcard['fn'];
659         $result['nick'] = $vcard['nick'];
660         $result['url'] = $profile;
661         $result['addr'] = $addr;
662         $result['notify'] = $notify;
663         $result['poll'] = $poll;
664         $result['request'] = $request;
665         $result['confirm'] = $confirm;
666         $result['photo'] = $vcard['photo'];
667         $result['priority'] = $priority;
668         $result['network'] = $network;
669         $result['alias'] = $alias;
670         $result['pubkey'] = $pubkey;
671
672         logger('probe_url: ' . print_r($result,true), LOGGER_DEBUG);
673
674         return $result;
675 }