I need to extract to PDF
the content HTML
of a page inf_ev_003_7.php
The problem is that I only extract the HTML
and not the data I get through SQL
and PHP
in this inf_ev_003_7.php
**así es mi código crearPdf.php:**
<?php
// Cargamos la librería dompdf que hemos instalado en la carpeta dompdf
include("../../../config/lib/dompdf/autoload.inc.php");
use Dompdf\Dompdf;
ini_set('display_errors', 1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
$rut = $_GET['rut'];
$ev = $_GET['ev'];
// Introducimos HTML de prueba
$html=file_get_contents_curl("http://localhost/inf_ev_003_7.php?ev='.$ev.'&rut='.$rut.'");
echo $html;
exit;
// Instanciamos un objeto de la clase DOMPDF.
$pdf = new DOMPDF();
// Definimos el tamaño y orientación del papel que queremos.
$pdf->set_paper("letter", "portrait");
//$pdf->set_paper(array(0,0,104,250));
// Cargamos el contenido HTML.
$pdf->load_html(utf8_decode($html));
// Renderizamos el documento PDF.
$pdf->render();
// Enviamos el fichero PDF al navegador.
$pdf->stream('reporte_evaluacion2.pdf');
function file_get_contents_curl($url) {
$crl = curl_init();
$timeout = 5;
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
$ret = curl_exec($crl);
curl_close($crl);
return $ret;
}
I need to know what I'm missing or what I'm doing wrong, since I do not get the data rescued by sql
and php
of my page inf_ev_003_7.php
in pdf
.