forked from science-ation/science-ation
29 lines
698 B
PHP
29 lines
698 B
PHP
<?
|
|
function generate_pdf($template_id=1, $inputs=[]){
|
|
|
|
$inputs = array($inputs);
|
|
|
|
|
|
$data = array(
|
|
'template_id' => $template_id,
|
|
'inputs' => $inputs
|
|
);
|
|
$postfields_json = json_encode($data);
|
|
|
|
$ch = curl_init();
|
|
error_log($postfields_json);
|
|
curl_setopt($ch, CURLOPT_URL,"http://10.15.183.210:3000/api/generate_pdf");
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields_json);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
|
|
'Content-Type: application/json',
|
|
'Connection: Keep-Alive'
|
|
));
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
$server_output = curl_exec($ch);
|
|
|
|
curl_close($ch);
|
|
}
|
|
?>
|