Real Time QR Code Generator PHP Function

UPDATE: Please read this post. You will be able to create more different images now!

If you have read my earlier posts, you must have seen that I am excited about implementing QR Code to my projects. These mostly include my work projects.

Today I have discovered that Fukuchi Kentaro, who is an assistant professor has written a very useful QR Code library to use on UNIX based systems. I have immediately downloaded the library and compiled it. It ran smoothly on my server, so I created a little PHP function to use with this library, for real time QR Code generation.

I have put a page on my server for you to use the function. You can call that page supplying a base64 encoded URL and it will create a QR Code PNG on the fly.

This is a demonstration of calling the page:

http://www.keremerkan.net/qrcode/qr.php?c=aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo=

UPDATE: The page gets redirected to PHP QR Code Generator page on this blog now.

aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo= is Base64 encoded presentation of my blog URL, http://keremerkan.net/

You can easily Base64 encode this string by executing the command below from a UNIX shell:

echo http://keremerkan.net/ | openssl enc -base64

The function will only accept Base64 encoded URLs to avoid some nasty side effects. Also after decoding the URL, there should be no dangerous characters like ‘,!,<,> in the URL.

By calling the page like I gave above, you will get the image below (It is auto generated):

To read this image from your phone, you will need a QR Code reader installed on your mobile phone. You can get a QR Code reader from QuickMark or Kaywa sites for free. (PS: Kaywa reader needs you to register for download)

You may also like...