2010-07-01 19:48:07 -04:00
|
|
|
<?php
|
2017-05-07 14:44:30 -04:00
|
|
|
|
|
|
|
use Friendica\Network\Probe;
|
2010-07-01 19:48:07 -04:00
|
|
|
|
2011-08-18 02:10:55 -04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Probe a network address to discover what kind of protocols we need to communicate with it.
|
|
|
|
*
|
|
|
|
* Warning: this function is a bit touchy and there are some subtle dependencies within the logic flow.
|
|
|
|
* Edit with care.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* PROBE_DIASPORA has a bias towards returning Diaspora information
|
|
|
|
* while PROBE_NORMAL has a bias towards dfrn/zot - in the case where
|
2012-02-19 13:27:54 -05:00
|
|
|
* an address (such as a Friendica address) supports more than one type
|
2015-11-04 18:42:38 -05:00
|
|
|
* of network.
|
2011-08-18 02:10:55 -04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-07-03 18:14:08 -04:00
|
|
|
define('PROBE_NORMAL', 0);
|
|
|
|
define('PROBE_DIASPORA', 1);
|
2011-04-15 03:59:00 -04:00
|
|
|
|
2015-06-13 19:52:26 -04:00
|
|
|
function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
|
2015-12-06 12:52:19 -05:00
|
|
|
|
2016-07-03 18:14:08 -04:00
|
|
|
if ($mode == PROBE_DIASPORA)
|
|
|
|
$network = NETWORK_DIASPORA;
|
|
|
|
else
|
|
|
|
$network = "";
|
2015-12-06 12:52:19 -05:00
|
|
|
|
2016-07-03 18:14:08 -04:00
|
|
|
$data = Probe::uri($url, $network);
|
2015-01-20 16:54:25 -05:00
|
|
|
|
2016-07-03 18:14:08 -04:00
|
|
|
return $data;
|
2011-04-15 03:59:00 -04:00
|
|
|
}
|