- hash_hmac: documentation ( source)
- sha1: documentation ( source)
- base64_encode: documentation ( source)
- gmdate: documentation ( source)
- json_encode: documentation ( source)
- md5: documentation ( source)
<?php
$username = "robstark@winterfell.com";
$secretKey = sha1("L1v3rp00@");
$verb = "GET";
$body = json_encode("{\"Request\":{\"satn\":\"213456\"},\"emailAddress\":\"robstark@winterfell.com\"}");
$contentmd5 = base64_encode(md5($body, true));
$contentType = "application/json";
$dateNow = gmdate("c");
$authCode = base64_encode(hash_hmac("sha1", $verb . "\n" . $contentmd5 . "\n" . $contentType . "\n" . $dateNow, $secretKey));
$header = "Content-Type: application/json" . "\n" . "Content-Length: " . strlen($body) . "\n" . "Content-MD5: " . $contentmd5 . "\n" . "Date: " . $dateNow . "\n" . "Authorization: RDN " . $username . ":" . $authCode;
print($header);