On Dec 12, 2013, at 10:14 AM, Salar Darwish <[email protected]> wrote:

> Hello,
> 
> I am very new with cloudstack and trying to generate a signature to reqeust
> some simpel api's with php. I use the following script but still get the

you might want to check this one out:

https://github.com/qpleple/cloudstack-php-client/blob/master/src/BaseCloudStackClient.php



> error:
> 
> unable to verify user credentials and/or request signature
> 
> Can some one help me what is the mistake here. Thank you in advance
> 
> $apikey =
> "apikey=BN_HAbfozXjgmwUFIFLtJ7wMkhxoN7Wn2kU0_0gtGed1wu7rZDw3yHbc4QjRN-PjJRkgY1EsCWYMBlwcf0k99Q";
> 
> $secretkey =
> "IUobE620Jg3CCxNA_amoaWeoMjXh5GNU0zjhYfXjZGbq9JxOsnQlutF5VjDF3-fZ2715JEceteNqnN6bN3woqw";
> 
> $response = "response=json";
> 
> $urlcommand_deployvm = $apikey . "&command=listUsers" . "&" . $response;
> 
> $hashcommand = $apikey . "&". "command=listUsers" . "&". $response;
> 
> $query = str_replace("+", "%20", $hashcommand );
> 
> $lower = strtolower($hashcommand);
> 
> $hash = hash_hmac("SHA1", $lower, $secretkey . true, TRUE);
> 
> $base64encoded = base64_encode($hash);
> 
> $signature = "signature=" . urlencode($base64encoded);
> 
> $url = "http://localhost:8080/client/api?"; . $urlcommand_deployvm . "&" .
> $signature;

Reply via email to