Files
BE_CPONE/application/controllers/chart/Qr_polos.php
2026-04-27 10:26:26 +07:00

40 lines
1.1 KiB
PHP

<?php
class Qr_polos extends MY_Controller
{
public function __construct()
{
parent::__construct();
}
function pcr($nolab)
{
$img_qrcode = $this->post("http://localhost/charts/qrtext.php", $nolab);
header("Content-type: image/png");
echo $img_qrcode;
exit;
}
public function post($url, $data)
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
array(
'Content-Type: application/text',
'Content-Length: ' . strlen($data)
)
);
$result = curl_exec($ch);
if (curl_error($ch) != "") {
return "ERROR Accessing QrCode : " . curl_error($ch) . "\n";
}
curl_close($ch);
return $result;
}
}