function clients_connection_drupal_services_6_2::xmlrpc_key_args in Web Service Clients 7.3
Same name and namespace in other branches
- 6.2 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services_6_2::xmlrpc_key_args()
- 7 backends/clients_drupal/clients_drupal.inc \clients_connection_drupal_services_6_2::xmlrpc_key_args()
- 7.2 connections/clients_drupal/clients_drupal.inc \clients_connection_drupal_services_6_2::xmlrpc_key_args()
Helper function to get key-related method arguments for the XMLRPC call.
3 calls to clients_connection_drupal_services_6_2::xmlrpc_key_args()
- clients_connection_drupal_services_5::callMethodArray in connections/
clients_drupal/ clients_drupal.inc - Call a remote method with an array of parameters.
- clients_connection_drupal_services_6_2::callMethodArray in connections/
clients_drupal/ clients_drupal.inc - Call a remote method with an array of parameters.
- clients_connection_drupal_services_6_2::call_user_login in connections/
clients_drupal/ clients_drupal.inc - Log in as the configured user.
File
- connections/
clients_drupal/ clients_drupal.inc, line 442 - Contains classes for Client connections handlers.
Class
- clients_connection_drupal_services_6_2
- Drupal client for services on a Drupal 6 site for Services 6.x-2.x.
Code
function xmlrpc_key_args($method) {
$api_key = $this->configuration['servicekey'];
// Build the API key arguments - if no key supplied supplied, presume not required
if ($api_key != '') {
// Use API key to get a hash code for the service.
$timestamp = (string) strtotime("now");
// Note that the domain -- at least for Services 5 and 6.x-2.x -- is a
// purely arbitrary string more akin to a username.
// See http://drupal.org/node/821700 for background.
$domain = $this->configuration['domain'];
/*
if (!strlen($domain)) {
$domain = $_SERVER['SERVER_NAME'];
if ($_SERVER['SERVER_PORT'] != 80) {
$domain .= ':' . $_SERVER['SERVER_PORT'];
}
}
*/
$nonce = uniqid();
$hash_parameters = array(
$timestamp,
$domain,
$nonce,
$method,
);
$hash = hash_hmac("sha256", implode(';', $hash_parameters), $api_key);
$key_args = array(
$hash,
$domain,
$timestamp,
$nonce,
);
}
else {
$key_args = array();
}
return $key_args;
}