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; } }