PHP 8.1.28 Released!

xmlrpc_is_fault

(PHP 4 >= 4.3.0, PHP 5, PHP 7)

xmlrpc_is_fault配列の値が XMLRPC の失敗であるかどうかを調べる

説明

xmlrpc_is_fault(array $arg): bool
警告

この関数は、 実験的 なものです。この関数の動作・ 名前・その他ドキュメントに書かれている事項は、予告なく、将来的な PHP のリリースにおいて変更される可能性があります。 この関数は自己責任で使用してください。

パラメータ

arg

xmlrpc_decode() が返す配列。

戻り値

引数が失敗を表す場合に true、それ以外の場合に false を返します。 失敗の内容は $arg["faultString"]、失敗のコードは $arg["faultCode"] に格納されます。

xmlrpc_encode_request() の例を参照ください。

参考

add a note

User Contributed Notes 1 note

up
1
angelo at at dot com
13 years ago
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']);
}

?>
To Top