How i can loadHTMLFile and settime out

169 views Asked by At

I want to use mPDF to save data, But i am not very good in PHP. This is my code.

<?php
include("mpdf/mpdf.php");

$doc = new DomDocument();
$doc->loadHTMLFile($_GET['page'].'.php?fdlDate='.$_GET['fdlDate']);
$doc->setTimeout(7000);

$getContent = $doc->getElementById('content');

$mpdf=new mPDF('th','A4',0,'',10,10,20,10,10,'');
$mpdf->WriteHTML($getContent);
$mpdf->Output();
?>

It have a error.

Warning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity &quot;taxAPrint.php?fdlDate=2015-06-23&quot; in ...\mPDF.php on line 5

Fatal error: Call to undefined method DOMDocument::setTimeout() in ...\mPDF.php on line 6

What wrong? Thank you very much.

1

There are 1 answers

0
Dezza On

DOMDocument does not have a method called setTimeout(), which is why you cannot set a timeout and get the fatal error.

You also have a warning that the file you're trying to load in loadHTMLFile() can't be found. You might want to use var_dump() to check the values that you're passing in and make sure that they make sense from the server's perspective. Remember that the server does not make any assumptions at all and will do what you tell it to do, literally.