value. * Keys are handle, values are WebFinger instances. */ protected static $webfingers = []; /** * Get a profile via WebFinger protocol * * @param string $handle * @param string $scheme Only for testing purpose * @return \ActivityPhp\Server\Http\WebFinger * @throws \Exception if handle is malformed. */ public static function get(string $handle, string $scheme = 'https') { if (!preg_match( '/^@?(?P[\w\-\.]+)@(?P[\w\.\-]+)(?P:[\d]+)?$/', $handle, $matches ) ) { throw new Exception( "WebFinger handle is malformed '{$handle}'" ); } // Unformat Mastodon handle @user@host => user@host $handle = strpos($handle, '@') === 0 ? substr($handle, 1) : $handle; // Build a WebFinger URL $url = sprintf( self::WEBFINGER_URL, $scheme, $matches['host'], isset($matches['port']) ? $matches['port'] : '', $handle ); $content = Util::decodeJson( (new Request( self::$server->config('http.timeout'), self::$server->config('http.agent') ))->get($url) ); if (!is_array($content) || !count($content)) { throw new Exception('WebFinger fetching has failed'); } self::$webfingers[$handle] = new WebFinger($content); return self::$webfingers[$handle]; } /** * Inject a server instance * * @param \ActivityPhp\Server $server */ public static function setServer(Server $server) { self::$server = $server; } } __halt_compiler();----SIGNATURE:----HH8qi1yhKFFjOsgMvI1hBd8FZG22DX1DNK5s4PwUod7FRZpUZpNVXxJAhiK2xdVbT+1PzftKYlfh9DUaVevSBR+eRoFCzN8a5JTVc68fWClbRvLcwde+o2K5R6zb5+9Ng2OL1cZI8X2tIhU1DFX4Oe/gcmSa2Uo+elWDmNUOamSB23VQ5GWmcVgxhBkzDp0ERNoxR6haUMWqv/R7Wla9haSALaIQ6um/IB1ubPXNeKtaFGiKkrXw2mOMg6I/kKuIlR/mhW2hfWVC2QyhFaUDkEHlWqXETNlnfTF54sFQG0GFGXG7sqpnQigkqMbds46DgSpjhYZTAoYw+19RStW2MvjMbpSNhKbfyepCSogzv3x9aRFuAXl0dLnu+ndrBrx4nmgXMZP+LrN+NkUYEQtC69yd7jQ+MNUrMipwkRHHSMzx3Og7oppaGlW7BzqdzwxG1K893h6zncSIqfHVKOEDnb9IEjP442m3XJYvc5VGXJDk+A8PCA6sn02q8qX4Z0XJFEVK25ULHI7KB/8ZBtS3fyuPCDlt0CFaBtg72Azl0Xfmj2UrXdITayn8Fdkkge7sv/sqSFRDnMTM65hghtkXWnV5XlXiOT5pf/rjOJCbHO4imwz9iysRXqII8g76L50ni1buGOnHvX2zzbZ4ShAThde4+CMe6tDTG1AdK8hIu78=----ATTACHMENT:----Nzg1OTc1MDc0NzU0OTE5NCAxODUyMzA1NTgxNTA3OCA5NDMxMzAyNTk0MzExODY4