コード例 #1
0
 public function composeUrl($iSigner, $credential, $domain)
 {
     $apiParams = parent::getQueryParameters();
     $apiParams["RegionId"] = $this->getRegionId();
     $apiParams["AccessKeyId"] = $credential->getAccessKeyId();
     $apiParams["Format"] = $this->getAcceptFormat();
     $apiParams["SignatureMethod"] = $iSigner->getSignatureMethod();
     $apiParams["SignatureVersion"] = $iSigner->getSignatureVersion();
     $apiParams["SignatureNonce"] = uniqid();
     date_default_timezone_set("GMT");
     $apiParams["Timestamp"] = date($this->dateTimeFormat);
     $apiParams["Action"] = $this->getActionName();
     $apiParams["Version"] = $this->getVersion();
     $apiParams["Signature"] = $this->computeSignature($apiParams, $credential->getAccessSecret(), $iSigner);
     if (parent::getMethod() == "POST") {
         $requestUrl = $this->getProtocol() . "://" . $domain . "/";
         foreach ($apiParams as $apiParamKey => $apiParamValue) {
             $this->putDomainParameters($apiParamKey, $apiParamValue);
         }
         return $requestUrl;
     } else {
         $requestUrl = $this->getProtocol() . "://" . $domain . "/?";
         foreach ($apiParams as $apiParamKey => $apiParamValue) {
             $requestUrl .= "{$apiParamKey}=" . urlencode($apiParamValue) . "&";
         }
         return substr($requestUrl, 0, -1);
     }
 }