Skip to content

Instantly share code, notes, and snippets.

@larsschenk
Last active January 27, 2020 00:57
Show Gist options
  • Save larsschenk/824b859e2769b7959e108cbdd4fcab24 to your computer and use it in GitHub Desktop.
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.
<?php // Hide the API key and the url to the API and serve the image directly
$png = file_get_contents('https://api.activebarcode.net/v1/png?code=CODE128&text=ActiveBarcode&access=YOUR-KEY-HERE');
echo '<img src="data:image/png;base64,'. base64_encode($png) .'" />';
@larsschenk
Copy link
Author

larsschenk commented Jan 27, 2020

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment