// For complete examples and data files, please go to https://github.com/aspose-total/Aspose.Total-for-Cloud public function sign($url, $queryParams) { // parse the url $UrlToSign = rtrim($url, "/"); $url = parse_url($UrlToSign); $urlQuery = http_build_query($queryParams); $urlPartToSign = $url['scheme'] . '://' . $url['host'] . $url['path'] . "?" . $url['query']; // Create a signature using the private key and the URL-encoded // string using HMAC SHA1. This signature will be binary. $signature = hash_hmac('sha1', $urlPartToSign, $this->apiKey, true); $encodedSignature = self::encodeBase64UrlSafe($signature); $encodedSignature = str_replace(array('=', '-', '_'), array('', '%2b', '%2f'), $encodedSignature); preg_match_all("/%[0-9a-f]{2}/", $encodedSignature, $m); foreach ($m[0] as $code) { $encodedSignature = str_replace($code, strtoupper($code), $encodedSignature); } $url = $urlPartToSign . '&signature=' . $encodedSignature; return $url; }