<?php
if(!empty($_GET['epi_doc_url']) && !empty($_GET['auth']) ){
    $ch = curl_init($_GET['epi_doc_url']."?".$_SERVER['QUERY_STRING']);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    //curl_setopt($ch, CURLOPT_HEADER, 1);
    //curl_setopt($ch, CURLOPT_VERBOSE, true);

    $auth = is_array($_GET['auth']) ? join(",", $_GET['auth']) : $_GET['auth'];
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Cookie: $auth"));

    $result = curl_exec($ch);
    echo $result;
} else {
    echo 'Bad Request';
}