/** * 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); }
<?php require_once __DIR__ . "/../src/utils/PhpProxy.php"; require_once __DIR__ . "/../config.php"; $proxy = new PhpProxy(); $proxy->setRemoteSite($xapiEndpoint); $proxy->dispatch();
<?php require_once dirname(__FILE__) . "/PhpProxy.php"; //print_r($_SERVER); $proxy = new PhpProxy(); $proxy->setRemoteSite("http://staging.tunapanda.org/learninglocker/public/data/xAPI/"); $proxy->dispatch();