- chr: documentation ( source)
- time: documentation ( source)
- hash_hmac: documentation ( source)
- hexdec: documentation ( source)
<?php
$expire = time() + 2592000;
$proto = 'http://';
$domain = 'nlds179.cdnak.neulion.com';
$path = '/nlds_vod/ufc/vod/2014/03/27/ufc-pride-pride34-eventreplay/ufc-pride-pride34-eventreplay_2_3000.mp4';
$key = '0326ebdb3e654166a66d3c62';
$params = 'expires='.$expire.'~access=/nlds_vod/ufc/vod/2014/03/27/ufc-pride-pride34-eventreplay/*';
function h2b($str) {
$bin = "";
$i = 0;
do {
$bin .= chr(hexdec($str{$i}.$str{($i + 1)}));
$i += 2;
} while ($i < strlen($str));
return $bin;
}
$hash = hash_hmac('MD5', $params, h2b($key));
echo $proto.$domain.'/'.$path.'?hdnea='.$params.'~md5='.$hash;
?>