-
-
Save rezarajan/66ed58c18f2c2bb51ed0e42dd4437738 to your computer and use it in GitHub Desktop.
Generate a QR code using Google Charts API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Source: http://stackoverflow.com/questions/5943368/dynamically-generating-a-qr-code-with-php | |
| // Google Charts Documentation: https://developers.google.com/chart/infographics/docs/qr_codes?csw=1#overview | |
| // CHart Type | |
| $cht = "qr"; | |
| // CHart Size | |
| $chs = "300x300"; | |
| // CHart Link | |
| // the url-encoded string you want to change into a QR code | |
| $chl = urlencode("http://aamnah.com"); | |
| // CHart Output Encoding (optional) | |
| // default: UTF-8 | |
| $choe = "UTF-8"; | |
| $qrcode = 'https://chart.googleapis.com/chart?cht=' . $cht . '&chs=' . $chs . '&chl=' . $chl . '&choe=' . $choe; | |
| echo $qrcode . '<br>'; | |
| ?> | |
| <img src="<?php echo $qrcode ?>" alt="My QR code"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment