db->query($sql, [$orderHeaderID]); if (!$qry) { echo "Err : " . $this->db->error()["message"]; exit; } $rows = $qry->result_array(); if (count($rows) == 0) { echo "Err : Doctor ID not found."; exit; } $r = $rows[0]; $sip = ""; $nama_dokter = $r["M_StaffName"]; /* $sip = $r["M_DoctorSIP"]; */ /* $nama_dokter = ""; */ /* if ($r["M_DoctorPrefix"] != "") { */ /* $nama_dokter = $r["M_DoctorPrefix"]; */ /* } */ /* if ($r["M_DoctorPrefix2"] != "") { */ /* if ($nama_dokter != "") $nama_dokter .= " "; */ /* $nama_dokter = $r["M_DoctorPrefix2"]; */ /* } */ /* if ($nama_dokter != "") $nama_dokter .= " "; */ /* $nama_dokter = $r["M_DoctorName"]; */ /**/ /* if ($r["M_DoctorSuffix"] != "") { */ /* if ($nama_dokter != "") $nama_dokter .= " "; */ /* $nama_dokter = $r["M_DoctorSuffix"]; */ /* } */ /* if ($r["M_DoctorSuffix2"] != "") { */ /* if ($nama_dokter != "") $nama_dokter .= " "; */ /* $nama_dokter = $r["M_DoctorSuffix2"]; */ /* } */ /* if ($r["M_DoctorSuffix3"] != "") { */ /* if ($nama_dokter != "") $nama_dokter .= " "; */ /* $nama_dokter = $r["M_DoctorSuffix3"]; */ /* } */ $msg = $title . "\n"; $msg .= "Tanggal : " . date("d-m-Y H:n", strtotime($r["T_OrderHeaderDate"])) . "\n"; $msg .= "Nama : " . $nama_dokter . "\n"; $msg .= "SIP : " . $sip; $img_qrcode = $this->post("http://localhost/charts/qrtext.php", $msg); header("Content-type: image/png"); echo $img_qrcode; } 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, [ "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; } }