<?php
ini_set('display_errors', 0);


include 'inc/db_config.php'; 


mysqli_query($connection,'SET CHARACTER SET utf8');
mysqli_query($connection,"SET SESSION collation_connection ='utf8_general_ci'");





$settingsSQL = mysqli_query($connection, "SELECT * FROM `settings` where name='terms' ");
$settingsSQL = mysqli_fetch_object($settingsSQL);
									
$terms = $settingsSQL->value;	


												  


								   


use Dompdf\Dompdf;
use Dompdf\Options;
require_once 'jobs/dompdf/autoload.inc.php';
$options = new Options();
$options->set('isRemoteEnabled', TRUE);
$dompdf = new Dompdf($options);

$context = stream_context_create([ 
	'ssl' => [ 
		'verify_peer' => FALSE, 
		'verify_peer_name' => FALSE,
		'allow_self_signed'=> TRUE 
	] 
]);
$dompdf->setHttpContext($context);


?>

<?php
// reference the Dompdf namespace
 
//$url = "http://crm.weddingdiary.com.bd/crm/booking_print1.php?id=27";
//$output=file_get_contents($url);

$handle = curl_init();
 
$url = "https://weddingdiarybooking.com/new_crm/booking_tmp_pdf_helper.php?id=".$temp_id;
// Set the url
curl_setopt($handle, CURLOPT_URL, $url);
// Set the result output to be a string.
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
 
$output = curl_exec($handle);
 
curl_close($handle);
 


$terms=$output."<h1> Terms and Conditions </h1>".$terms."<br /> <font-size='3'> (This is Electronic Copy of Booking, hence no signature required.) </font>";




// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml($terms);

// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml($terms);

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('A4', 'portrait');

// Render the HTML as PDF
$dompdf->render();
$filename="Booking_form.pdf";
$output = $dompdf->output();





file_put_contents($filename, $output);




?>