---
title: "Real Time QR Code Generator PHP Function"
description: "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…"
date: 2007-04-17
tags: ["libqrencode", "Linux", "PHP", "QR Code"]
canonical: https://keremerkan.dev/posts/real-time-qr-code-generator-php-function/
---

_UPDATE:_ Please read [this post](/posts/new-php-qr-code-generator-page/). 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](http://megaui.net/fukuchi/index.en.html), who is an assistant professor has written a very useful [QR Code library](http://megaui.net/fukuchi/works/qrencode/index.en.html "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.dev/qrcode/qr.php?c=aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo=` _UPDATE:_ The page gets redirected to [PHP QR Code Generator](https://qrafter.app/qr-code-generator) page on this blog now. **aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo=** is Base64 encoded presentation of my blog URL, **http://keremerkan.dev/** You can easily Base64 encode this string by executing the command below from a UNIX shell:

echo http://keremerkan.dev/ | 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):~

![](../../assets/images/qr_blog.png)

To read this image from your phone, you will need a QR Code reader installed on your mobile phone.
