Scalr

Yet another post

[[Wiki]]

h1. Scalr API

  • http://wiki.scalr.net/display/docs/API

h2. PHP

  • PHP Example - http://wiki.scalr.net/download/attachments/327715/ScalrAPI.example.php?version=2&modificationDate=1335371895000

 'ListFarms',
        'Version'	=> API_VERSION,
        'Timestamp'	=> date("c"),
        'KeyID'		=> SCALR_API_KEY
    );
	
    // Sorg arguments
    ksort($params);
        	
    // Generate string for sign
	$string_to_sign = "";
	foreach ($params as $k => $v)
        $string_to_sign .= "{$k}{$v}";
                
    // Generate signature
	$params['Signature'] = base64_encode(hash_hmac('SHA256', $string_to_sign, SCALR_SECRET_KEY, 1));
        
	// Build query
	$query = http_build_query($params);
        
	// Execute query
	$c = file_get_contents(API_URL."?{$query}");
	
	// Print result
	print " pre ";
	print htmlspecialchars($c);
 
?>


h2. Joomla and PHP

  • http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-content/4470