} else { $this->lastTransportErrorMessage = $errMsg; $this->lastTransportErrorNumber = $errNo; curl_close($curlCon); return false; } } public function execute($method, $path, $requestData) { if (!isset($path)) { header("HTTP/1.1 404 Not Found"); die; } $url = $this->config['destination_url'] . $path; $headers = $this->getHeaders(); $content = $this->grabContent($method, $url, $requestData, $headers); if ($content === false) { header("HTTP/1.1 500"); echo $this->lastTransportErrorNumber . ' ' . $this->lastTransportErrorMessage; die; } foreach ($this->lastHeaders as $header) { header($header); } echo $content; die; } } $proxy = new Proxy(require 'config.php'); $proxy->execute($_SERVER['REQUEST_METHOD'], $_GET['path'], file_get_contents('php://input'));