MIME::Base64URLSafe - URL-safe Base64 Encoder/Decoder
PHP implementation of Perl module MIME::Base64::URLSafe.
use \MIME\Base64URLSafe;
$output = Base64URLSafe::urlsafe_b64encode('Original Message');
// "T3JpZ2luYWwgTWVzc2FnZQ"
use \MIME\Base64URLSafe;
$input = Base64URLSafe::urlsafe_b64decode('T3JpZ2luYWwgTWVzc2FnZQ');
// "Original Message"
Encode a string into base64 string.
Decode a base64 string into string.
$xml = '<hello>world</hello>';
$query_safe_data = Base64URLSafe::urlsafe_b64encode(gzdeflate($xml));
echo http_build_query(array('data' => $query_safe_data), '&');
$query_safe_data = $_GET['data'];
$xml = gzinflate(Base64URLSafe::urlsafe_b64decode($query_safe_data));
echo $xml;