예제 #1
0
파일: DataProxy.php 프로젝트: pokupo/client
            throw new Exception("Wrong url");
        }
    }
    public function Query()
    {
        $this->Route();
        print $this->responseData;
    }
    private function GetData($url)
    {
        $cookie = array();
        foreach ($_COOKIE as $i => $one) {
            $cookie[] = $i . '=' . $one;
        }
        if ($cookie) {
            $opts = array('http' => array('method' => "GET", 'header' => "Cookie: " . implode('; ', $cookie) . "\r\n"));
        } else {
            $opts = array('http' => array('method' => "GET"));
        }
        $context = stream_context_create($opts);
        $this->responseData = file_get_contents($url, false, $context);
        foreach ($http_response_header as $value) {
            if (preg_match('/^Set-Cookie:/i', $value)) {
                header($value, false);
            }
        }
    }
}
$proxy = new DataProxy($_GET);
$proxy->Query();