Last active
December 31, 2015 04:06
-
-
Save noname007/518d733d31d3831c1938 to your computer and use it in GitHub Desktop.
金山 直播 签名生成
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 | |
$_param['accesskey'] = KS_AK; | |
$_param['expire'] = time()+3*3600; | |
$_param['method'] = 'add'; | |
$_param['app'] = 'appappapp'; | |
$_param['name'] = 'test'; | |
$_param['nonce'] = uniqid(); | |
$_param['public'] = 1; | |
$_param['vdoid'] = 1; | |
$gen_signature_lambda = function ($_param){ | |
$sign_key = ['nonce','public','vdoid']; | |
$t = ''; | |
foreach ($sign_key as $v) | |
{ | |
$t .= $v.'='.urlencode($_param[$v]) .'&'; | |
} | |
$t = rtrim($t,'&'); | |
$to_sign_str = "GET\n{$_param['expire']}\n$t"; | |
echo $to_sign_str,PHP_EOL; | |
return base64_encode(hash_hmac('sha1',$to_sign_str,KS_SK,true)); | |
}; | |
$_param['signature'] = $gen_signature_lambda($_param); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment