diff options
author | zotlabs <mike@macgirvin.com> | 2018-08-15 21:33:11 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-08-15 21:33:11 -0700 |
commit | 32acb0ff01b8fde3801fafbd7953aa36b5933f96 (patch) | |
tree | de706faa72c908cd2ee8acef0fe77c949e418401 /Zotlabs/Module/Zot_probe.php | |
parent | f230c07ba5ed71c0491c6fd109c0789d2cc341c1 (diff) | |
download | volse-hubzilla-32acb0ff01b8fde3801fafbd7953aa36b5933f96.tar.gz volse-hubzilla-32acb0ff01b8fde3801fafbd7953aa36b5933f96.tar.bz2 volse-hubzilla-32acb0ff01b8fde3801fafbd7953aa36b5933f96.zip |
missing files
Diffstat (limited to 'Zotlabs/Module/Zot_probe.php')
-rw-r--r-- | Zotlabs/Module/Zot_probe.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Zotlabs/Module/Zot_probe.php b/Zotlabs/Module/Zot_probe.php new file mode 100644 index 000000000..d0c7e688f --- /dev/null +++ b/Zotlabs/Module/Zot_probe.php @@ -0,0 +1,47 @@ +<?php + +namespace Zotlabs\Module; + +use Zotlabs\Lib\Zotfinger; +use Zotlabs\Zot6\HTTPSig; + +class Zot_probe extends \Zotlabs\Web\Controller { + + function get() { + + $o .= '<h3>Zot6 Probe Diagnostic</h3>'; + + $o .= '<form action="zot_probe" method="get">'; + $o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" /><br>'; + $o .= '<input type="submit" name="submit" value="Submit" /></form>'; + + $o .= '<br /><br />'; + + if(x($_GET,'addr')) { + $addr = $_GET['addr']; + + + $x = Zotfinger::exec($addr); + + $o .= '<pre>' . htmlspecialchars(print_array($x)) . '</pre>'; + + $headers = 'Accept: application/x-zot+json, application/jrd+json, application/json'; + + $redirects = 0; + $x = z_fetch_url($addr,true,$redirects, [ 'headers' => [ $headers ]]); + + if($x['success']) { + + $o .= '<pre>' . htmlspecialchars($x['header']) . '</pre>' . EOL; + + $o .= 'verify returns: ' . str_replace("\n",EOL,print_r(HTTPSig::verify($x),true)) . EOL; + + $o .= '<pre>' . htmlspecialchars(json_encode(json_decode($x['body']),JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)) . '</pre>' . EOL; + + } + + } + return $o; + } + +} |