/** * Dispatch. */ public function dispatch() { $curl = curl_init(); $url = $this->remoteSite . PhpProxy::getPath(); curl_setopt($curl, CURLOPT_URL, $url); $headers = array(); foreach ($this->headers as $header => $value) { $headers[$header] = $value; } if (sizeof($this->forwardHeaders)) { $inheaders = getallheaders(); foreach ($this->forwardHeaders as $header => $value) { $headers[$header] = $inheaders[$header]; } } curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) { curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($curl, CURLOPT_USERPWD, $_SERVER['PHP_AUTH_USER'] . ":" . $_SERVER['PHP_AUTH_PW']); } curl_exec($curl); }