Reputation: 1143
I currently have a page that generates HTML and fills in fields based on $_GET
values from the previous PHP page.
I would like to convert the HTML of the page that I am on to a PDF and load it.
Can anybody help me out?
For some reason I get this as an error on page load:
Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/html/asapweb/libs/full.php on line 2
Warning: require_once(http://kenai.asap.um.maine.edu/asapweb/libs/dompdf/dompdf_config.inc.php): failed to open stream: no suitable wrapper could be found in /var/www/html/asapweb/libs/full.php on line 2
Fatal error: require_once(): Failed opening required 'http://kenai.asap.um.maine.edu/asapweb/libs/dompdf/dompdf_config.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/asapweb/libs/full.php on line 2
My page:
<?php
require_once("http://kenai.asap.um.maine.edu/asapweb/libs/dompdf/dompdf_config.inc.php");
ob_start();
?>
<html>
<body>
<div style="width: 1000px; height: 1000px;">
<h2><center>ASAP APPLICATION FORM</center></h2>
<hr style="width: 700px;"><br>
<div style="float: left; margin-left: 15%;">Date Submitted: <b><?php echo $_GET['dateSubmitted'] ?></b><br>
<div style="margin-top: 50px;"><h3><i>PERSONAL INFORMATION</i></h3></div><br>
<div style="margin-left: 50px">
Name: <b><u><?php echo $_GET['firstName']." ".$_GET['lastName'] ?></u></b><br>
Address: <b><u><?php echo $_GET['address'] ?></u></b><br>
Phone: <b><u><?php echo $_GET['phone'] ?></u></b><br>
Email: <b><u><?php echo $_GET['email'] ?></u></b><br>
</div>
</div>
<div style="float: right; margin-right: 150px; margin-top: 50px;"><h3><i>ACADEMIC INFORMATION</i></h3><br>
<div style="margin-top: 5px; margin-left: 50px;">
Major: <b><u><?php echo $_GET['major'] ?></u></b><br>
Expected Graduation Year: <b><u><?php echo $_GET['gradDate'] ?></u></b><br>
Relevant work?: <b><u><?php echo ucfirst($_GET['work']) ?></u></b><br>
</div>
</div>
<div style="margin-top: 250px; margin-left: 39%;"><h3><i>TELL US MORE ABOUT YOU</i></h3><br>
<div style="margin-left: -200px; margin-top: 20px;"><b>Position(s) interested in:</b> <?php echo $_GET['positions'] ?></div>
<br>
<div style="margin-left: -200px; margin-bottom: 50px;"><b>Do you have work-study?</b> <?php echo $_GET['workStudy'] ?></div>
<div style="float: right; margin-right: 100px;">
<span style="margin-left: 70px;">Describe your creative strengths:</span><br>
<textarea rows="10" cols="40" style="margin-top: 20px;"><?php echo $_GET['previousExperience'] ?></textarea>
</div>
<div style="margin-left: -240px;">
<span style="margin-left: 30px;">Briefly describe your previous work experience:</span><br>
<textarea rows="10" cols="40" style="margin-top: 20px;"><?php echo $_GET['creativeStrengths'] ?></textarea>
</div>
<br>
<div style="float: right; margin-right: 100px;">
<span style="margin-left: 100px;">What are your skills?:</span><br>
<textarea rows="10" cols="40" style="margin-top: 20px;"><?php echo $_GET['skills'] ?></textarea>
</div>
<div style="margin-left: -240px;">
<span style="margin-left: 50px;">What interests you about this position?:</span><br>
<textarea rows="10" cols="40" style="margin-top: 20px;"><?php echo $_GET['interests'] ?></textarea>
</div>
</div><br>
</div>
</body>
</html>
<?php
$html = ob_get_clean();
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
?>
Thanks in advance!
Upvotes: 0
Views: 1487
Reputation: 5147
Try the below code
include("dompdf/dompdf_config.inc.php");
Assuming that your dompdf_config.inc.php is available in following path.
/var/www/html/asapweb/dompdf/dompdf_config.inc.php
Upvotes: 1
Reputation: 16512
You can only require
and include
files using the local server path, not the external HTTP path. (unless you have allow_url_include
set to true
)
Change this line
require_once("http://kenai.asap.um.maine.edu/asapweb/libs/dompdf/dompdf_config.inc.php");
to
require_once($_SERVER['DOCUMENT_ROOT']."/asapweb/libs/dompdf/dompdf_config.inc.php");
This is assuming the path is correct from your server's docroot.
Upvotes: 1