xmlrpc_is_fault

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

xmlrpc_is_faultDetermina se un valore di un array rappresenta un errore XMLRPC

Descrizione

xmlrpc_is_fault(array $arg): bool
Avviso

Questa funzione è SPERIMENTALE. Ovvero, il comportamento di questa funzione, il nome di questa funzione, in definitiva tutto ciò che è documentato qui può cambiare nei futuri rilasci del PHP senza preavviso. Siete avvisati, l'uso di questa funzione è a vostro rischio.

Elenco dei parametri

arg

Array restituito da xmlrpc_decode().

Valori restituiti

Restituisce true se l'argomento significa un errore, false altrimenti. La descrizione dell'errore è disponibile in $arg["faultString"], il codice dell'errore è in $arg["faultCode"].

Esempi

Vedere gli esempi di xmlrpc_encode_request().

Vedere anche:

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