Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you read QR Codes in PHP?

Tags:

php

qr-code

Is there a plain PHP implementation for decoding QR codes?

I have a faux-smartphone. One of those phones that parades as a smartphone but that I can't download any apps for, and I want to create an email service to where I can take a picture of a QR code, MMS it to this email, and the email returns what the QR code contains.

However, the only libraries I've been able to find are in Python (and probably C++), neither of which I can access on my limited hosting environment.

Is there a way to read QR codes using only PHP?

like image 745
Navarr Avatar asked Oct 10 '10 08:10

Navarr


People also ask

How do I read the contents of a QR code?

Scanning a QR code using your device is straightforward: Open the QR reader application or the camera on your smartphone. Point it at the QR code – you should be able to point your camera from any angle and still receive the necessary information.

How do you read a QR code on a website?

1. 3D Touch the Chrome app icon and choose Scan QR Code. 2. Pull down to reveal the Spotlight search box, search for "QR" and select Scan QR Code from Chrome's listing.


2 Answers

There is only one pure PHP QR code decoder. It's working with GD library, but can use also ImageMagick. This PHP QR code reader is ported from ZXing.

https://github.com/khanamiryan/php-qrcode-detector-decoder

like image 119
Ashot Khanamiryan Avatar answered Sep 23 '22 03:09

Ashot Khanamiryan


I'm not aware of any pure php decoder. Decoding images like this is pretty processor intensive and doing it in a purely interpreted language is challenging.

zxing (http://code.google.com/p/zxing/) provides a decoder implementation in both Java and C++. In theory, it should be possible to link the C++ library as a php extension, though I don't know anything of the mechanics of that. I've done it for Ruby ...

Moreover, zxing does have an online decoder at http://zxing.org/w/decode.jspx. My thinking is that from PHP you can take the image and post it to the webservice and retrieve the decoded data. I don't know the mechanics of making remote web service calls from PHP and how different hosting environments might limit that, though, but it seems reasonable?

like image 26
smparkes Avatar answered Sep 20 '22 03:09

smparkes