Skip to content

Instantly share code, notes, and snippets.

@Dieterbe
Created October 29, 2012 20:49
Show Gist options
  • Save Dieterbe/3976450 to your computer and use it in GitHub Desktop.
Save Dieterbe/3976450 to your computer and use it in GitHub Desktop.
generate tempURL for openstack swift
#!/usr/bin/php
<?php
$method = 'GET';
$base = $argv[1];
$path = $argv[2];
$key = $argv[3];
$expires = time() + $argv[4];
$hmac_body = "$method\n$expires\n$path";
$sig = hash_hmac('sha1', $hmac_body, $key);
echo "$base$path?temp_url_sig=$sig&temp_url_expires=$expires\n";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment