2010-07-02 01:48:07 +02:00
|
|
|
<?php
|
2017-05-07 20:44:30 +02:00
|
|
|
|
|
|
|
use Friendica\Network\Probe;
|
2010-07-02 01:48:07 +02:00
|
|
|
|
2011-08-18 08:10:55 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* 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 19:27:54 +01:00
|
|
|
* an address (such as a Friendica address) supports more than one type
|
2015-11-05 00:42:38 +01:00
|
|
|
* of network.
|
2011-08-18 08:10:55 +02:00
|
|
|
*
|
|
|
|
*/
|
2016-07-04 00:14:08 +02:00
|
|
|
define('PROBE_NORMAL', 0);
|
|
|
|
define('PROBE_DIASPORA', 1);
|
2011-04-15 09:59:00 +02:00
|
|
|
|
2017-05-07 21:00:38 +02:00
|
|
|
/**
|
|
|
|
* @brief Probes 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.
|
|
|
|
*
|
|
|
|
* @deprecated Use Friendica\Network\Probe instead
|
|
|
|
*
|
|
|
|
* @see Friendica\Network\Probe::uri()
|
|
|
|
*
|
|
|
|
* @param string $url Any URI
|
|
|
|
* @param int $mode One of the PROBE_* constants
|
|
|
|
* @return array Same data array returned by Friendica\Network\Probe::uri()
|
|
|
|
*/
|
|
|
|
function probe_url($url, $mode = PROBE_NORMAL) {
|
2015-12-06 18:52:19 +01:00
|
|
|
|
2017-05-07 21:00:38 +02:00
|
|
|
if ($mode == PROBE_DIASPORA) {
|
2016-07-04 00:14:08 +02:00
|
|
|
$network = NETWORK_DIASPORA;
|
2017-05-07 21:00:38 +02:00
|
|
|
} else {
|
|
|
|
$network = '';
|
|
|
|
}
|
2015-12-06 18:52:19 +01:00
|
|
|
|
2016-07-04 00:14:08 +02:00
|
|
|
$data = Probe::uri($url, $network);
|
2015-01-20 22:54:25 +01:00
|
|
|
|
2016-07-04 00:14:08 +02:00
|
|
|
return $data;
|
2011-04-15 09:59:00 +02:00
|
|
|
}
|