Reputation: 694
Hi i need to generate a QR, (QR ISO/IEC 18004:2000)
Using some data
re=
rr=
tt=
id=
Here is an example of a chain.
$data = "?re=AAA010101AAA&rr=CAJR820905IP1&tt=116.00&id= 556bef95-8322-4897-ae65-3b5e9de593f8";
I have found this link:
http://phpqrcode.sourceforge.net/examples/index.php?example=001
I have not idea at all, of how to build a QR using my data and that library, can anyone point at my stupidity pls..
thanks
EDIT Here is the real answer that i get thanks to the advice wich point me in the rigth direction. (thats why i mark it as correct answer). Anyway, someone may need this.
To genereate a QR (CBB in other countries) you can use the library http://phpqrcode.sourceforge.net/
Follow this. Create a file to generate the QR, in my case (/common/qrcode.php)
Inside this file you must insert the code to generate QR, depending on what you need. This example03 its pretty good for this.
include('phpqrcode/qrlib.php');
$param = $_GET['id']; // remember to sanitize that - it is user input!
// we need to be sure ours script does not output anything!!!
// otherwise it will break up PNG binary!
ob_start("callback");
// here DB request or some processing
$codeText = 'DEMO - '.$param;
// end of processing here
$debugLog = ob_get_contents();
ob_end_clean();
// outputs image directly into browser, as PNG stream
QRcode::png($codeText);
Then in your view or page where you want to display the QR, you can do this,
$ourParamId = 1234;
echo '<img src="/common/qrcode.php?id='.$ourParamId.'" />';
Hopes this helps someone.
Upvotes: 0
Views: 893
Reputation: 2728
Well, the link that you have mentioned in the question is the answer:
<?php
include('../lib/full/qrlib.php');
// outputs image directly into browser, as PNG stream
QRcode::png('PHP QR Code :)');
So you can have a page which accepts the data and displays the QR code as an image and you can have a script that reads the image and save it to DB or filesystem.
Hope this helps!
Upvotes: 1