crawl bot
<?php /* ******************************************** * Lou_QRcode.class * Generator QR codes * Author:antlou * Version:1.0 * Date:2017/05/27 ******************************************** */ class qrcode { private $data; //creating code with link mtadata public function link($url){ if (preg_match('/^http:\/\//', $url) || preg_match('/^https:\/\//', $url)) { $this->data = $url; } else { $this->data = "http://".$url; } } //creating text qr code public function text($text){ $this->data = $text; } //creating code with phone public function phone_number($phone){ $this->data = "TEL:".$phone; } //creating code with mecard metadata public function contact_info ($name, $address, $phone, $email){ $this->data = "MECARD:N:".$name.";ADR:".$address." ;TEL:".$phone.";EMAIL:".$email.";;"; } //creating code with geo location metadata public function geo($lat, $lon, $height){ $this->data = "GEO:".$lat.",".$lon.",".$height; } //getting image public function get_image ($size = 150, $EC_level = 'L', $margin = '0'){ $ch = curl_init(); $this->data = urlencode($this->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_level.' |'.$margin.'&chl='.$this->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; } //getting link for image public function get_link ($size = 150, $EC_level = 'L', $margin = '0'){ $this->data = urlencode($this->data); return 'http://chart.apis.google.com/chart? chs='.$size.'x'.$size.'&cht=qr&chld='.$EC_level.' |'.$margin.'&chl='.$this->data; } //forcing image download public function download_image($file){ header('Content-Disposition: attachment; filename=QRcode.png'); header('Content-Type: image/png'); echo $file; } //save image to server public function save_image ($file, $path = "./QRcode.png"){ file_put_contents($path, $file); } } ?>
<?php /* **************************************** *QRcode.class * Generator QR codes * Author:antlou * Version:1.0 * Date:2017/05/27 **************************************** */ require_once("QRcode_class.php");$qr = new qrcode();//link$qr->link("http://www.infoscript.pt");echo "<p>Link : http://www.infoscript.pt </p>";echo "<p><img src='".$qr->get_link()."' border='0'/></p>";//text$qr->text("Hello World!");echo '<p>UTF8 text : "Hello World!"</p>';echo '<p><img src="'.$qr->get_link().'" border="0"/></p>';//phone number$qr->phone_number("12345678");echo '<p>Telephone number : "12345678"</p>';echo '<p><img src="'.$qr->get_link().'" border="0"/></p>';//geo location works on smartphones//First param - latitude//Second param - longitude//Third param - height above earth in meters$qr->geo("40.902517", "-8.491024", "100");echo '<p>Geographical location : 40.902517", "-8.491024", "100"</p>';echo "<p><img src='".$qr->get_link()."' border='0'/></p>";//here is the way to output imageheader("Content-type: image/png");echo $qr->get_image();//and here is the way to force image download$file = $qr->get_image();$qr->download_image($file)?>
Link : www.infoscript.pt