このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
- 02 Apache2で自己認証ssl [中間証明書の整合性確認]
最近の更新
※signature生成時の注意点
<?php
$api_key = 'API キー';
$sak = '秘密鍵';
$command = 'listVirtualMachines';
$url = 'https://hogehoge.com/client/api?';
$params = array(
'response' => 'json',
'command' => $command,
'apikey' => $api_key,
);
$query_str = '';
ksort($params);
foreach($params as $k => $v){
$query_str .= urlencode($k) . "=" . rawurlencode($v) . "&";
}
$query_str = rtrim($query_str, "&");
#echo strtolower($query_str)."\n";
$sig = base64_encode(hash_hmac ( 'sha1' , strtolower($query_str), $sak, true));
$final = $url . $query_str . "&signature=" . urlencode($sig);
echo "API URL: $final \n";
?>