Last active
April 2, 2025 22:40
-
-
Save larsschenk/824b859e2769b7959e108cbdd4fcab24 to your computer and use it in GitHub Desktop.
ActiveBarcode API call with server side script like php to obfuscate the API key.
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 // Hide the API key and the url to the API and serve the image directly | |
$png = file_get_contents('https://api.activebarcode.net/v2/png?code=CODE128&text=ActiveBarcode&access=YOUR-KEY-HERE'); | |
echo '<img src="data:image/png;base64,'. base64_encode($png) .'" />'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make the API call on the server
If you have the need to hide the API-key at your public html code, you can make the API call on the server. This php code snippet will give you the basic idea. You can migrate this to any other server side scripting language.
https://www.activebarcode.com/rest/