You are here

function _acquia_agent_request in Acquia Connector 7

Same name and namespace in other branches
  1. 6.2 acquia_agent/acquia_agent_streams.inc \_acquia_agent_request()
  2. 6 acquia_agent/acquia_agent_streams.inc \_acquia_agent_request()
  3. 7.3 acquia_agent/acquia_agent.module \_acquia_agent_request()
  4. 7.2 acquia_agent/acquia_agent.module \_acquia_agent_request()

Send a XML-RPC request.

This function should never be called directly - use acquia_agent_call().

1 call to _acquia_agent_request()
acquia_agent_call in acquia_agent/acquia_agent.module
Prepare and send a XML-RPC request to Acquia Network with an authenticator.

File

acquia_agent/acquia_agent.module, line 553
Acquia Agent securely sends information to Acquia Network.

Code

function _acquia_agent_request($url, $method, $data) {
  $ctx = acquia_agent_stream_context_create($url);
  if (!$ctx) {

    // TODO: what's a meaningful fault code?
    xmlrpc_error(-1, t('SSL is not supported or setup failed'));
    $result = FALSE;
  }
  else {
    $result = xmlrpc($url, array(
      $method => array(
        $data,
      ),
    ), array(
      'context' => $ctx,
    ));
  }
  if ($errno = xmlrpc_errno()) {
    watchdog('acquia agent', '@message (@errno): %server - %method - <pre>@data</pre>', array(
      '@message' => xmlrpc_error_msg(),
      '@errno' => xmlrpc_errno(),
      '%server' => $url,
      '%method' => $method,
      '@data' => print_r($data, TRUE),
    ), WATCHDOG_ERROR);
  }
  return $result;
}