©
本文档使用 PHP中文网手册 发布
(PHP 4 >= 4.3.0, PHP 5)
xmlrpc_is_fault — Determines if an array value represents an XMLRPC fault
$arg
)此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担 。
arg
Array returned by xmlrpc_decode() .
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() .
[#1] angelo at at dot com [2011-01-25 12:31:26]
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 new Exception($response['faultString'], $response['faultCode']);
}
?>