In this post we explain you, how you can generate QR code with metadata by google api. You can generat qr code for any link, email, telephone number or text data.
For generate code, you can use following php script:
<?php /* Online PHP Examples with Source Code website: http://4evertutorials.blogspot.in/ */ function google_qr_code($data, $type = "TXT", $size ='150', $ec='L', $margin='0') { $types = array("URL" => "http://", "TEL" => "TEL:", "TXT"=>"", "EMAIL" => "MAILTO:"); if(!in_array($type,array("URL", "TEL", "TXT", "EMAIL"))) { $type = "TXT"; } if (!preg_match('/^'.$types[$type].'/', $data)) { $data = str_replace("\\", "", $types[$type]).$data; } $ch = curl_init(); $data = urlencode($data); curl_setopt($ch, CURLOPT_URL, 'http://chart.apis.google.com/chart'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, 'chs='.$size.'x'.$size.'&cht=qr&chld='.$ec.'|'.$margin.'&chl='.$data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 30); $response = curl_exec($ch); curl_close($ch); return $response; } header("Content-type: image/png"); echo google_qr_code("4evertutorials","TXT"); //echo google_qr_code("http://4evertutorials.blogspot.com","URL"); //echo google_qr_code("4evertutorial@gmail.com","EMAIL"); //echo google_qr_code("1234567890","TEL"); ?>
1 comments:
Too cool!
I’m truly enjoying the design and layout of your blog. It’s a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a designer to create your theme?
Excellent work!
QR Code Generator Service
Post a Comment