{"id":1994,"date":"2016-12-07T16:54:59","date_gmt":"2016-12-07T16:54:59","guid":{"rendered":"https:\/\/www.codexworld.com\/?p=1994"},"modified":"2016-12-07T18:03:01","modified_gmt":"2016-12-07T18:03:01","slug":"generate-qr-code-php-google-chart-api","status":"publish","type":"post","link":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/","title":{"rendered":"How to Generate QR Code with PHP using Google Chart API"},"content":{"rendered":"<p><b>QR Code<\/b> is a machine-readable code that consists of black squares on a white background. QR code typically used for storing information which readable by the camera. Sometimes you required to generating dynamic QR code for products, members, or other items in your application. You&#8217;ll find many QR code generator libraries to create QR code. But Google Chart API provides a simple way to <b>generate QR code in PHP<\/b> without any libraries or plugin.<\/p>\n<p>In this tutorial, we&#8217;ll show how you can generate QR code with PHP using <b>Google Chart API and cURL<\/b>. Our PHP QR code generator script allows you to generate dynamic QR code for URL, text, email, phone, SMS, contact details, and other content.<\/p>\n<p>We&#8217;ve created PHP QR code generator class called <code>QR_BarCode<\/code>, that helps to generate QR code image (PNG) or save QR code image as PNG file.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;*&nbsp;QR_BarCode&nbsp;-&nbsp;Barcode&nbsp;QR&nbsp;Code&nbsp;Image&nbsp;Generator<br \/>&nbsp;*&nbsp;@author&nbsp;CodexWorld<br \/>&nbsp;*&nbsp;@url&nbsp;http:\/\/www.codexworld.com<br \/>&nbsp;*&nbsp;@license&nbsp;http:\/\/www.codexworld.com\/license\/<br \/>&nbsp;*\/<br \/><\/span><span style=\"color: #007700\">class&nbsp;<\/span><span style=\"color: #0000BB\">QR_BarCode<\/span><span style=\"color: #007700\">{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Google&nbsp;Chart&nbsp;API&nbsp;URL<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">private&nbsp;<\/span><span style=\"color: #0000BB\">$googleChartAPI&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">'http:\/\/chart.apis.google.com\/chart'<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/\/&nbsp;Code&nbsp;data<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">private&nbsp;<\/span><span style=\"color: #0000BB\">$codeData<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;URL&nbsp;QR&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$url<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">url<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$url&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">preg_match<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"#^https?\\:\\\/\\\/#\"<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$url<\/span><span style=\"color: #007700\">)&nbsp;?&nbsp;<\/span><span style=\"color: #0000BB\">$url&nbsp;<\/span><span style=\"color: #007700\">:&nbsp;<\/span><span style=\"color: #DD0000\">\"http:\/\/<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$url<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Text&nbsp;QR&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$text<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">text<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$text<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">$text<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Email&nbsp;address&nbsp;QR&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$email<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$subject<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$message<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">email<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$email&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$subject&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$message&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"MATMSG:TO:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$email<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;SUB:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$subject<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;BODY:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$message<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;;\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Phone&nbsp;QR&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$phone<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">phone<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$phone<\/span><span style=\"color: #007700\">){<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"TEL:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$phone<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;SMS&nbsp;QR&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$phone<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$text<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">sms<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$phone&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$msg&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"SMSTO:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$phone<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$msg<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;VCARD&nbsp;QR&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$name<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$address<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$phone<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$email<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">contact<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$name&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$address&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$phone&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$email&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"MECARD:N:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$name<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;ADR:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$address<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;TEL:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$phone<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;EMAIL:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$email<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;;\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Content&nbsp;(gif,&nbsp;jpg,&nbsp;png,&nbsp;etc.)&nbsp;QR&nbsp;code<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$type<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$size<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$content<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">content<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$type&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$size&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$content&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #DD0000\">\"CNTS:TYPE:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$type<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;LNG:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$size<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;BODY:<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$content<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">;;\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #FF8000\">\/**<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Generate&nbsp;QR&nbsp;code&nbsp;image<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;int&nbsp;$size<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@param&nbsp;string&nbsp;$filename<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@return&nbsp;bool<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*\/<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #007700\">public&nbsp;function&nbsp;<\/span><span style=\"color: #0000BB\">qrCode<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$size&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">200<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$filename&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">null<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$ch&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">curl_init<\/span><span style=\"color: #007700\">();<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_URL<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">googleChartAPI<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_POST<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_POSTFIELDS<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">\"chs=<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$size<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">x<\/span><span style=\"color: #007700\">{<\/span><span style=\"color: #0000BB\">$size<\/span><span style=\"color: #007700\">}<\/span><span style=\"color: #DD0000\">&amp;cht=qr&amp;chl=\"&nbsp;<\/span><span style=\"color: #007700\">.&nbsp;<\/span><span style=\"color: #0000BB\">urlencode<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$this<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">codeData<\/span><span style=\"color: #007700\">));<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_RETURNTRANSFER<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_HEADER<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_setopt<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">CURLOPT_TIMEOUT<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">30<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$img&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;<\/span><span style=\"color: #0000BB\">curl_exec<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">curl_close<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$ch<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">$img<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(<\/span><span style=\"color: #0000BB\">$filename<\/span><span style=\"color: #007700\">)&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!<\/span><span style=\"color: #0000BB\">preg_match<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"#\\.png$#i\"<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$filename<\/span><span style=\"color: #007700\">))&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">$filename&nbsp;<\/span><span style=\"color: #007700\">.=&nbsp;<\/span><span style=\"color: #DD0000\">\".png\"<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">file_put_contents<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">$filename<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #0000BB\">$img<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/span><span style=\"color: #0000BB\">header<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">\"Content-type:&nbsp;image\/png\"<\/span><span style=\"color: #007700\">);<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;<\/span><span style=\"color: #0000BB\">$img<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">true<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;<\/span><span style=\"color: #0000BB\">false<\/span><span style=\"color: #007700\">;<br \/>&nbsp;&nbsp;&nbsp;&nbsp;}<br \/>}<br \/><\/span><span style=\"color: #0000BB\">?&gt;<\/span><\/pre>\n<p>To create QR code PNG image, use QR_BarCode class like the following.<\/p>\n<pre><span style=\"color: #FF8000\">\/\/&nbsp;include&nbsp;QR_BarCode&nbsp;class&nbsp;<br \/><\/span><span style=\"color: #007700\">include&nbsp;<\/span><span style=\"color: #DD0000\">\"QR_BarCode.php\"<\/span><span style=\"color: #007700\">;&nbsp;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;QR_BarCode&nbsp;object&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr&nbsp;<\/span><span style=\"color: #007700\">=&nbsp;new&nbsp;<\/span><span style=\"color: #0000BB\">QR_BarCode<\/span><span style=\"color: #007700\">();&nbsp;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;text&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">text<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'CodexWorld'<\/span><span style=\"color: #007700\">);&nbsp;<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;display&nbsp;QR&nbsp;code&nbsp;image<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">qrCode<\/span><span style=\"color: #007700\">();<\/span><\/pre>\n<p>The above example code will generate and display QR code like the below.<\/p>\n<div class=\"img_center\"><\/div>\n<p>If you want to save QR code image, use QR_BarCode class like the following.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;save&nbsp;QR&nbsp;code&nbsp;image<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">qrCode<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #0000BB\">350<\/span><span style=\"color: #007700\">,<\/span><span style=\"color: #DD0000\">'images\/cw-qr.png'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<p>QR_BarCode class generates the different type of QR code in PHP.<\/p>\n<pre><span style=\"color: #0000BB\">&lt;?php<br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;url&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">url<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'URL'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;text&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">text<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'textContent'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;email&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">email<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'emailAddress'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'subject'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'message'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;phone&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">phone<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'phoneNumber'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;sms&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">sms<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'phoneNumber'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'message'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;contact&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">contact<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'name'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'address'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'phone'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'email'<\/span><span style=\"color: #007700\">);<br \/><br \/><\/span><span style=\"color: #FF8000\">\/\/&nbsp;create&nbsp;content&nbsp;QR&nbsp;code&nbsp;<br \/><\/span><span style=\"color: #0000BB\">$qr<\/span><span style=\"color: #007700\">-&gt;<\/span><span style=\"color: #0000BB\">content<\/span><span style=\"color: #007700\">(<\/span><span style=\"color: #DD0000\">'type'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'size'<\/span><span style=\"color: #007700\">,&nbsp;<\/span><span style=\"color: #DD0000\">'content'<\/span><span style=\"color: #007700\">);<\/span><\/pre>\n<h2>Conclusion<\/h2>\n<p>The QR_BarCode class makes QR code creation quicker and easier. Only one file (<code>QR_BarCode.php<\/code>) need to be included to generate different types of QR code. The cURL is used in <code>QR_BarCode<\/code> class, make sure <a href=\"http:\/\/www.codexworld.com\/how-to-guides\/how-to-enable-curl-in-php-xampp-wamp-ubuntu\/\">cURL is enabled in PHP<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>QR Code is a machine-readable code that consists of black squares on a white background. QR code typically used for storing information which readable by the camera. Sometimes you required to generating dynamic QR code <\/p>\n","protected":false},"author":1,"featured_media":1995,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[245,14,244],"class_list":["post-1994","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-barcode","tag-php","tag-qr","cat-4-id","has_thumb"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Generate QR Code with PHP using Google Chart API - CodexWorld<\/title>\n<meta name=\"description\" content=\"PHP QR code generator script - Learn how to generate QR code with PHP using Google Chart API and cURL. Create dynamic QR code for URL, text, email, phone, SMS, contact details, and other content.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Generate QR Code with PHP using Google Chart API - CodexWorld\" \/>\n<meta property=\"og:description\" content=\"PHP QR code generator script - Learn how to generate QR code with PHP using Google Chart API and cURL. Create dynamic QR code for URL, text, email, phone, SMS, contact details, and other content.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/\" \/>\n<meta property=\"og:site_name\" content=\"CodexWorld\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codexworld\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-07T16:54:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-12-07T18:03:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/12\/generate-qr-code-with-php-using-google-chart-api-codexworld.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1366\" \/>\n\t<meta property=\"og:image:height\" content=\"768\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"CodexWorld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codexworldblog\" \/>\n<meta name=\"twitter:site\" content=\"@codexworldweb\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"CodexWorld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/\"},\"author\":{\"name\":\"CodexWorld\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\"},\"headline\":\"How to Generate QR Code with PHP using Google Chart API\",\"datePublished\":\"2016-12-07T16:54:59+00:00\",\"dateModified\":\"2016-12-07T18:03:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/\"},\"wordCount\":247,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/generate-qr-code-with-php-using-google-chart-api-codexworld.png\",\"keywords\":[\"Barcode\",\"PHP\",\"QR\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/\",\"name\":\"How to Generate QR Code with PHP using Google Chart API - CodexWorld\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/generate-qr-code-with-php-using-google-chart-api-codexworld.png\",\"datePublished\":\"2016-12-07T16:54:59+00:00\",\"dateModified\":\"2016-12-07T18:03:01+00:00\",\"description\":\"PHP QR code generator script - Learn how to generate QR code with PHP using Google Chart API and cURL. Create dynamic QR code for URL, text, email, phone, SMS, contact details, and other content.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/generate-qr-code-with-php-using-google-chart-api-codexworld.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/generate-qr-code-with-php-using-google-chart-api-codexworld.png\",\"width\":1366,\"height\":768,\"caption\":\"generate-qr-code-with-php-using-google-chart-api-codexworld\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/generate-qr-code-php-google-chart-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.codexworld.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Generate QR Code with PHP using Google Chart API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#website\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"name\":\"CodexWorld\",\"description\":\"Web &amp; Mobile App Development Company\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.codexworld.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#organization\",\"name\":\"CodexWorld\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.codexworld.com\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/codexworld-logo.png\",\"width\":200,\"height\":19,\"caption\":\"CodexWorld\"},\"image\":{\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldweb\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/codexworld\",\"https:\\\/\\\/www.youtube.com\\\/codexworld\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.codexworld.com\\\/#\\\/schema\\\/person\\\/9da51d8fa3cdefeb5ec9c69136d4baf0\",\"name\":\"CodexWorld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g\",\"caption\":\"CodexWorld\"},\"description\":\"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.\",\"sameAs\":[\"http:\\\/\\\/www.codexworld.com\",\"https:\\\/\\\/www.facebook.com\\\/codexworld\",\"https:\\\/\\\/x.com\\\/codexworldblog\"],\"url\":\"https:\\\/\\\/www.codexworld.com\\\/author\\\/nitya192265\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Generate QR Code with PHP using Google Chart API - CodexWorld","description":"PHP QR code generator script - Learn how to generate QR code with PHP using Google Chart API and cURL. Create dynamic QR code for URL, text, email, phone, SMS, contact details, and other content.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/","og_locale":"en_US","og_type":"article","og_title":"How to Generate QR Code with PHP using Google Chart API - CodexWorld","og_description":"PHP QR code generator script - Learn how to generate QR code with PHP using Google Chart API and cURL. Create dynamic QR code for URL, text, email, phone, SMS, contact details, and other content.","og_url":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/","og_site_name":"CodexWorld","article_publisher":"https:\/\/www.facebook.com\/codexworld","article_author":"https:\/\/www.facebook.com\/codexworld","article_published_time":"2016-12-07T16:54:59+00:00","article_modified_time":"2016-12-07T18:03:01+00:00","og_image":[{"width":1366,"height":768,"url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/12\/generate-qr-code-with-php-using-google-chart-api-codexworld.png","type":"image\/png"}],"author":"CodexWorld","twitter_card":"summary_large_image","twitter_creator":"@codexworldblog","twitter_site":"@codexworldweb","twitter_misc":{"Written by":"CodexWorld","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#article","isPartOf":{"@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/"},"author":{"name":"CodexWorld","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0"},"headline":"How to Generate QR Code with PHP using Google Chart API","datePublished":"2016-12-07T16:54:59+00:00","dateModified":"2016-12-07T18:03:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/"},"wordCount":247,"commentCount":5,"publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"image":{"@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/12\/generate-qr-code-with-php-using-google-chart-api-codexworld.png","keywords":["Barcode","PHP","QR"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/","url":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/","name":"How to Generate QR Code with PHP using Google Chart API - CodexWorld","isPartOf":{"@id":"https:\/\/www.codexworld.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#primaryimage"},"image":{"@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/12\/generate-qr-code-with-php-using-google-chart-api-codexworld.png","datePublished":"2016-12-07T16:54:59+00:00","dateModified":"2016-12-07T18:03:01+00:00","description":"PHP QR code generator script - Learn how to generate QR code with PHP using Google Chart API and cURL. Create dynamic QR code for URL, text, email, phone, SMS, contact details, and other content.","breadcrumb":{"@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#primaryimage","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/12\/generate-qr-code-with-php-using-google-chart-api-codexworld.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/12\/generate-qr-code-with-php-using-google-chart-api-codexworld.png","width":1366,"height":768,"caption":"generate-qr-code-with-php-using-google-chart-api-codexworld"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codexworld.com\/generate-qr-code-php-google-chart-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codexworld.com\/"},{"@type":"ListItem","position":2,"name":"How to Generate QR Code with PHP using Google Chart API"}]},{"@type":"WebSite","@id":"https:\/\/www.codexworld.com\/#website","url":"https:\/\/www.codexworld.com\/","name":"CodexWorld","description":"Web &amp; Mobile App Development Company","publisher":{"@id":"https:\/\/www.codexworld.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codexworld.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codexworld.com\/#organization","name":"CodexWorld","url":"https:\/\/www.codexworld.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","contentUrl":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2014\/09\/codexworld-logo.png","width":200,"height":19,"caption":"CodexWorld"},"image":{"@id":"https:\/\/www.codexworld.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldweb","https:\/\/www.linkedin.com\/company\/codexworld","https:\/\/www.youtube.com\/codexworld"]},{"@type":"Person","@id":"https:\/\/www.codexworld.com\/#\/schema\/person\/9da51d8fa3cdefeb5ec9c69136d4baf0","name":"CodexWorld","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cf4999db3b409de559f80677afa01729bb2eeda19be273c254e8b2c22729e386?s=96&r=g","caption":"CodexWorld"},"description":"CodexWorld is a programming blog, one-stop destination for web professionals \u2014 developers, programmers, freelancers, and site owners.","sameAs":["http:\/\/www.codexworld.com","https:\/\/www.facebook.com\/codexworld","https:\/\/x.com\/codexworldblog"],"url":"https:\/\/www.codexworld.com\/author\/nitya192265\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.codexworld.com\/wp-content\/uploads\/2016\/12\/generate-qr-code-with-php-using-google-chart-api-codexworld.png","jetpack_shortlink":"https:\/\/wp.me\/p6bxIh-wa","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1994","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/comments?post=1994"}],"version-history":[{"count":3,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1994\/revisions"}],"predecessor-version":[{"id":1998,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/posts\/1994\/revisions\/1998"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media\/1995"}],"wp:attachment":[{"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/media?parent=1994"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/categories?post=1994"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codexworld.com\/wp-json\/wp\/v2\/tags?post=1994"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}