• Signature 阿里云签名值获取方法


    <?php
      
    function CreateUploadVideo(){
      $a='LT*****Q8';                
      $ck='hEro****vqPbj';  
      $h_8_time = time() - 8*60*60;
    
      $get_key = array('Format','Version','AccessKeyId','SignatureMethod','Timestamp','SignatureNonce','SignatureVersion','Action','Title','FileName');
      $get_key_value = array('Format' => 'JSON','Version' => '2017-03-21','SignatureMethod' => 'HMAC-SHA1','SignatureNonce' => time() + rand(50000,100000),'SignatureVersion' => '1.0','AccessKeyId' => $a,'Timestamp' => date('Y-m-d',$h_8_time).'T'.date('H:i:s',$h_8_time).'Z','Action' => 'CreateUploadVideo','Title' => 'PHP_Demo_signature','FileName'=>'config.mp4');
    
      sort($get_key);
      $StringToSign = 'GET&'.urlencode('/').'&';
      $q_str = '';
      foreach($get_key as $kval){
            $q_str .= urlencode($kval).'='.urlencode($get_key_value[$kval]).'&';
      }
      //echo $q_str."
    ";
      $q_str = substr($q_str,0,-1);
      //echo $q_str."
    ";
      $StringToSign .= urlencode($q_str);
      //echo $StringToSign."
    ";
      $ok_url = 'http://vod.cn-shanghai.aliyuncs.com?'.$q_str.'&Signature='.urlencode(base64_encode(hash_hmac("sha1",$StringToSign,$ck.'&',true))); //sha1($StringToSign,true)
      echo $ok_url."
    ";
    }
    
    CreateUploadVideo();
    
    ?>  
    

      

  • 相关阅读:
    学习心得——day2
    学习心得——day3
    学习心得——day1
    Android JNI so库的开发
    android 删除相册图片并同步到图库
    使用AccessibilityService执行开机自启动
    UDP Server
    uicode编码解码
    GreenDao的使用
    java之并发编程线程池的学习
  • 原文地址:https://www.cnblogs.com/makeinchina/p/9871998.html
Copyright © 2020-2023  润新知