Build Your Own QR Code Generator with Google Chart API

QR code has become more and more popular since it enables us to grab information instantly using a smart phone. It saves us time from typing a long reluctant URL to a small phone browser; Smart phones will auto dial a number by scanning a QR code using a QR code scanner.

As a developer, have you ever wonder how to build your own QR code generator? With the power of Google Chart API, building a QR code generator might be much easier than you thought.
Let us get started!

As a developer, have you ever wonder how to build your own QR code generator? With the power of Google Chart API, building a QR code generator might be much easier than you thought.
Let us get started!

Before We Start

At the end of this tutorial, you will build your own QR code generator similar to below:

Preparation

Create two php files called index.php and gen.php.

index.php: this will be the front page where users select size, encoding and error correction of the generated QR code image. And it is also the place to enter data for QR code.

gen.php: this page will request data from Google Charts API. And it is called from index.php above using an iframe.

First part of the code above is an HTML form with available options which will be passed to create the QR code image. Take note the form's target attribute's value is qrcode-frame. This tells the form to submit through an iframe.

Generate Your Own QR Code Now!

That is all, now your own QR code generator should be fully working. Navigate index.php from your browser and enter some data in content filed, select your desired options and click "generate" button.
You should be able to see a QR code being created instantly.

Opinions expressed in this article are those of the author and not necessarily those of Onextrapixel.