"value") ==> index.php?param=value function CallAPI($method, $url, $data = false){ $curl = curl_init(); switch ($method){ case "POST": curl_setopt($curl, CURLOPT_POST, 1); if ($data) curl_setopt($curl, CURLOPT_POSTFIELDS, $data); break; case "PUT": curl_setopt($curl, CURLOPT_PUT, 1); break; default: if ($data) $url = sprintf("%s?%s", $url, http_build_query($data)); } // Optional Authentication: //curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); //curl_setopt($curl, CURLOPT_USERPWD, "username:password"); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($curl); curl_close($curl); return $result; } // Default options : $lang="fr"; $public=true; $outputname="CV-MOLINIER_Etienne"; $outputsuffix=""; $outputextension=".pdf"; // Parse options provided by client if ( array_key_exists("privateinformationoutput",$_GET) && $_GET["privateinformationoutput"]=="true") { $public=false; } else { $outputsuffix="_public"; } if ( array_key_exists("lang",$_GET) && $_GET["lang"]=="en") { $lang="en"; $outputname="Resume MOLINIER Etienne"; } if ( array_key_exists("lang",$_GET) && $_GET["lang"]=="fr") { $lang="fr"; $outputname="CV MOLINIER Etienne"; } // load the latex code $tex=file_get_contents("resume.tex"); // check if we are allowed to print private informations if ($public) { // add the latex variable to display only public informations $tex="\def\ispublic{1}\n".$tex; } if ($lang=="en") { $tex="\\newif\ifenglish\n\\englishtrue".$tex; } else { $tex="\\newif\ifenglish\n\\englishfalse".$tex; } // prepare the data for the query $data =array( "pole"=>$tex, "pdf"=>"PDF", "preklad"=>"latex", "pruchod"=>"1", ".cgifields"=>"komprim" ); // and call the API $result = CallApi("POST","https://tex.mendelu.cz/en/",$data); //return the file. header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" . ($outputname.$outputsuffix.$outputextension) . "\""); //readfile($file_url); // do the double-download-dance (dirty but worky) echo $result; ?>