protected function FillPdfServicePdfBackend::xmlRpcRequest in FillPDF 5.0.x
Same name and namespace in other branches
- 8.4 src/Plugin/PdfBackend/FillPdfServicePdfBackend.php \Drupal\fillpdf\Plugin\PdfBackend\FillPdfServicePdfBackend::xmlRpcRequest()
Make an XML-RPC request.
Parameters
string $method: The method to call. Additional arguments are the paramters to the xmlrpc() call.
Return value
object Object with properties 'error' and 'data' representing the result of the request.
2 calls to FillPdfServicePdfBackend::xmlRpcRequest()
- FillPdfServicePdfBackend::mergeStream in src/
Plugin/ PdfBackend/ FillPdfServicePdfBackend.php - Populate a PDF file with field data.
- FillPdfServicePdfBackend::parseStream in src/
Plugin/ PdfBackend/ FillPdfServicePdfBackend.php - Parse a PDF and return a list of its fields.
File
- src/
Plugin/ PdfBackend/ FillPdfServicePdfBackend.php, line 66
Class
- FillPdfServicePdfBackend
- FillPDF Service PdfBackend plugin.
Namespace
Drupal\fillpdf\Plugin\PdfBackendCode
protected function xmlRpcRequest($method) {
$url = $this->configuration['remote_protocol'] . '://' . $this->configuration['remote_endpoint'];
$args = func_get_args();
// Fix up the array for Drupal 7 xmlrpc() function style.
$args = [
$args[0] => array_slice($args, 1),
];
$result = xmlrpc($url, $args);
$ret = new \stdClass();
if (isset($result['error'])) {
$this
->messenger()
->addError($result['error']);
$ret->error = TRUE;
}
elseif ($result == FALSE || xmlrpc_error()) {
$error = xmlrpc_error();
$ret->error = TRUE;
$this
->messenger()
->addError($this
->t('There was a problem contacting the FillPDF service.
It may be down, or you may not have internet access. [ERROR @code: @message]', [
'@code' => $error->code,
'@message' => $error->message,
]));
}
else {
$ret->data = $result['data'];
$ret->error = FALSE;
}
return $ret;
}