- chr: documentation ( source)
- hash_hmac: documentation ( source)
- hexdec: documentation ( source)
<?php
$expire = 1481437539;
$proto = 'http://';
$domain = 'nlds120.cdnak.neulion.com';
$path = 'nlds_vod/nba/vod/2016/12/10/21600351/fc9d4a/2_21600351_gsw_mem_2016_a_whole_1_ipad.mp4.m3u8';
$key = 'NBAtv';
$params = 'expires='.$expire.'~access=/nlds_vod/nba/vod/2016/12/10/21600351/fc9d4a/*';
function h2b($str) {
$bin = "";
$i = 0;
do {
$bin .= chr(hexdec($str{$i}.$str{($i + 1)}));
$i += 2;
} while ($i < strlen($str));
return $bin;
}
$bin = h2b($key);
$hash = hash_hmac('MD5', $params, $bin);
echo $bin;
echo $proto.$domain.'/'.$path.'?hdnea='.$params.'~md5='.$hash.'&nltid=nba&nltdt=6';
?>