You are here

function _fillpdf_xmlrpc_request in FillPDF 7

Same name and namespace in other branches
  1. 6 fillpdf.module \_fillpdf_xmlrpc_request()
  2. 7.2 fillpdf.module \_fillpdf_xmlrpc_request()
2 calls to _fillpdf_xmlrpc_request()
fillpdf_execute_merge in ./fillpdf.module
Utility to allow other functions to merge PDFs.
fillpdf_execute_parse in ./fillpdf.module
Utility to allow other functions to parse PDFs.

File

./fillpdf.module, line 1896

Code

function _fillpdf_xmlrpc_request($url, $method) {
  $args = func_get_args();

  // $url.
  array_shift($args);

  // Fix up the array for Drupal 7 xmlrpc() function style.
  $args = array(
    $args[0] => array_slice($args, 1),
  );

  // Use a large timeout so that large PDF files can be filled in as well.
  // An hour should be pretty safe.
  // @todo Make configurable?
  $result = xmlrpc($url, $args, array(
    'timeout' => 3600.0,
  ));
  $ret = new stdClass();
  if (isset($result['error'])) {
    drupal_set_message($result['error'], 'error');
    $ret->error = TRUE;
  }
  elseif ($result == FALSE || xmlrpc_error()) {
    $error = xmlrpc_error();
    $ret->error = TRUE;
    drupal_set_message(t('There was a problem contacting the FillPDF Service.
      It may be down, or you may not have internet access. [ERROR @code: @message]', array(
      '@code' => $error->code,
      '@message' => $error->message,
    )), 'error');
  }
  else {
    $ret->data = $result['data'];
    $ret->error = FALSE;
  }
  return $ret;
}