Created
June 25, 2011 11:24
-
-
Save cereda/1046383 to your computer and use it in GitHub Desktop.
PHP script to decode a Base64 string from a file
This file contains 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 | |
// Note: this script was written just for testing | |
// purposes. It has no error checking and other | |
// controls. DO NOT RUN THIS COMMAND WITHOUT | |
// REDIRECTING THE OUTPUT TO A FILE, e.g., | |
// convert.php mystring.txt > out.png | |
// open the file | |
$handler = fopen($argv[1], 'r'); | |
// fetch the contents | |
$data = fread($handler, filesize($argv[1])); | |
// close the file | |
fclose($handler); | |
// decode the contents and print | |
echo base64_decode($data); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment