request['header']['Authorization'] = self::_generateHeader($authInfo['user'], $authInfo['pass']); } } /** * Proxy Authentication * * @param HttpSocket $http * @param array $proxyInfo * @return void * @see http://www.ietf.org/rfc/rfc2617.txt */ public static function proxyAuthentication(HttpSocket $http, &$proxyInfo) { if (isset($proxyInfo['user'], $proxyInfo['pass'])) { $http->request['header']['Proxy-Authorization'] = self::_generateHeader($proxyInfo['user'], $proxyInfo['pass']); } } /** * Generate basic [proxy] authentication header * * @param string $user * @param string $pass * @return string */ protected static function _generateHeader($user, $pass) { return 'Basic ' . base64_encode($user . ':' . $pass); } }