(PHP 4 >= 4.3.0, PHP 5, PHP 7)
xmlrpc_is_fault — Determines if an array value represens an XMLRPC fault
This function is EXPERIMENTAL . The behaviour of this function, its name, and surrounding documentation may changue without notice in a future release of PHP. This function should be used at your own risc.
Returns
true
if the argument means fault,
false
otherwise. Fault
description is available in
$arg["faultString"]
, fault
code is in
$arg["faultCode"]
.
See example by xmlrpc_encode_request() .
A note, response from xmlrpc_decode is not always an array. Whenever the XMLRPC server returns a string, xmlrpc_is_fault will complain about not being an array.
Best way to detect errors is<?php
$response = xmlrpc_decode($file);
if (is_array($response) &&xmlrpc_is_fault($response)) {
throw newException($response['faultString'], $response['faultCode']);
}?>