PHP 8.3.4 Released!

xmlrpc_is_fault

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

xmlrpc_is_faultDetermines if an array value represents an XMLRPC fault

Beschreibung

xmlrpc_is_fault(array $arg): bool
Warnung

Diese Funktion ist EXPERIMENTELL. Das Verhalten, der Funktionsname und die zugehörige Dokumentation können sich in zukünftigen PHP-Versionen ohne Ankündigung ändern. Die Verwendung dieser Funktion erfolgt auf eigene Gefahr.

Parameter-Liste

arg

Array returned by xmlrpc_decode().

Rückgabewerte

Returns true if the argument means fault, false otherwise. Fault description is available in $arg["faultString"], fault code is in $arg["faultCode"].

Beispiele

See example by xmlrpc_encode_request().

Siehe auch

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