diff options
author | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-18 18:51:39 +0200 |
---|---|---|
committer | Haakon Meland Eriksen <haakon.eriksen@far.no> | 2015-09-18 18:51:39 +0200 |
commit | ce28760c2a7319f3cdc25c39a62582b722e91006 (patch) | |
tree | 802f64d3988fc14a277c79ee5192693a4202b502 /include/hubloc.php | |
parent | 438cb1d7e0f1518dd35a3a377dfd9a9fd885f80c (diff) | |
parent | 87c8cf489210136958d2e0b44e4c3ca48c1ff8af (diff) | |
download | volse-hubzilla-ce28760c2a7319f3cdc25c39a62582b722e91006.tar.gz volse-hubzilla-ce28760c2a7319f3cdc25c39a62582b722e91006.tar.bz2 volse-hubzilla-ce28760c2a7319f3cdc25c39a62582b722e91006.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/hubloc.php')
-rw-r--r-- | include/hubloc.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/include/hubloc.php b/include/hubloc.php index 396f4ddfa..674a3885f 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -275,4 +275,34 @@ function xchan_fetch($arr) { $ret[str_replace('xchan_','',$k)] = $v; } return $ret; -}
\ No newline at end of file +} + + + +function ping_site($url) { + + $ret = array('success' => false); + + $sys = get_sys_channel(); + + $m = zot_build_packet($sys,'ping'); + $r = zot_zot($url . '/post',$m); + if(! $r['success']) { + $ret['message'] = 'no answer from ' . $url; + return $ret; + } + $packet_result = json_decode($r['body'],true); + if(! $packet_result['success']) { + $ret['message'] = 'packet failure from ' . $url; + return $ret; + } + + if($packet_result['success']) { + $ret['success'] = true; + } + else { + $ret['message'] = 'unknown error from ' . $url; + } + + return $ret; +} |