friendica/include/probe.php

37 lines
773 B
PHP
Raw Normal View History

2010-07-01 23:48:07 +00:00
<?php
2017-05-07 18:44:30 +00:00
use Friendica\Network\Probe;
2010-07-01 23:48:07 +00:00
2011-08-18 06:10:55 +00: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 18:27:54 +00:00
* an address (such as a Friendica address) supports more than one type
* of network.
2011-08-18 06:10:55 +00:00
*
*/
2016-07-03 22:14:08 +00:00
define('PROBE_NORMAL', 0);
define('PROBE_DIASPORA', 1);
function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
2016-07-03 22:14:08 +00:00
if ($mode == PROBE_DIASPORA)
$network = NETWORK_DIASPORA;
else
$network = "";
2016-07-03 22:14:08 +00:00
$data = Probe::uri($url, $network);
2016-07-03 22:14:08 +00:00
return $data;
}