PHP 8.5.0 Alpha 2 available for testing

xmlrpc_is_fault

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

xmlrpc_is_faultDetermina si el valor de un arreglo representa una falla del XMLRPC

Descripción

xmlrpc_is_fault(array $arg): bool
Advertencia

Esta función es EXPERIMENTAL. El comportamiento de esta función, su nombre, y toda la documentación alrededor de esta función puede cambiar sin previo aviso en una próxima versión de PHP. Esta función debe ser utilizada bajo su propio riesgo.

Parámetros

arg

El arreglo devuelto por xmlrpc_decode().

Valores devueltos

Devuelve true si emabargo si el argumento significa fallo retorna, false. La descripción de la falla o falta está disponible en $arg["faultString"], fault el código está en $arg["faultCode"].

Ejemplos

Ver ejemplo dexmlrpc_encode_request().

Ver también

add a note

User Contributed Notes 1 note

up
1
angelo at at dot com
14 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