public static function getHKPResponse($uri) { $config = Keyserver::getConfig(); try { return Factory::forward(Keyserver::getRequest())->to('http://' . ($addr = (($primary = $config->hkp_primary_keyserver_addr && (strpos($uri, '/pks/lookup?op=stats') === 0 || strpos($uri, '/pks/hashquery') === 0)) ? $config->hkp_primary_keyserver_addr : $config->hkp_load_balanced_addr) . ':' . (!$primary && $config->hkp_load_balanced_port ? $config->hkp_load_balanced_port : $config->hkp_public_port)) . $uri); } catch (\Exception $e) { return new Response(Log::catchError($e, 'Double-check if the keyserver is up and running at the expected address:port (' . $addr . ').')); } }
public static function validateKey($key, $mail) { echo 'Checking ' . $mail . '..<br />'; return strpos(Factory::forward(Request::create('/pks/lookup?search=' . $key . '&op=vindex'))->to('http://' . Keyserver::getConfig()->hkp_load_balanced_addr . ':' . (Keyserver::getConfig()->hkp_load_balanced_port ?: Keyserver::getConfig()->hkp_public_port) . '/pks/lookup?search=' . $key . '&op=vindex')->getContent(), $mail) !== FALSE; }
<?php // ini_set('display_errors', 'On'); // error_reporting(E_ALL); require 'vendor/autoload.php'; use Proxy\Factory; use Proxy\Response\Filter\RemoveEncodingFilter; use Symfony\Component\HttpFoundation\Request; // Create a Symfony request based on the current browser request. $request = Request::createFromGlobals(); // Forward the request and get the response. $response = Factory::forward($request)->to($_REQUEST['url']); // Output response to the browser. // echo $response->getContent(); $response->send();