Base64 decode
Views:
quickly decode something with is base64 encoded on the command line. Useful for retrieving attachments from botched mail clients like outlook and hotmail.
#!/opt/local/bin/php
<?php
if ( isset($_SERVER['argv']) && isset($_SERVER['argv'][1]) &&
is_string($_SERVER['argv'][1]) && is_file($_SERVER['argv'][1]) ){
$code = file_get_contents($_SERVER['argv'][1]);
echo base64_decode($code);
} else {
echo "\nFirst argument must be the base 64 encoded text file to decode. Make sure you redirect the output to a new file\n";
die;
}
