Loading dompdf from subfolder

I can’t seem to target files outside the dompdf folder, I figured out I’d need the $dompdf->set_option('isRemoteEnabled', true);
setting to allow the script to process other pages on the site, but still no luck. This is my code so far;

$dompdf = new DOMPDF;
$dompdf->set_option( 'isRemoteEnabled', true );
$html = file_get_contents("http://www.example.com/test.html");
$dompdf->load_html($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
$pdf = $dompdf->output();
$dompdf->stream('test');

This gives the following output:

Read More

The called test.html exists and is reachable by the browser. If I replace that URL with something else like Google or Yahoo, it also does work.
What am I missing, is this a server configuration issue?

Related posts

1 comment

  1. I was wrong, the code is working. On the development server there was a htaccess blocking requests:

    SetEnvIfNoCase User-Agent ^$ keep_out
    SetEnvIfNoCase User-Agent (pycurl|casper|cmsworldmap|diavol|dotbot) keep_out
    SetEnvIfNoCase User-Agent (flicky|ia_archiver|kmccrew) keep_out
    SetEnvIfNoCase User-Agent (purebot|comodo|feedfinder|planetwork) keep_out
    Order Allow,Deny
    Allow from all
    Deny from env=keep_out
    

    Removed that, and it worked. Must be monday.

Comments are closed.