CakeFest 2024: The Official CakePHP Conference

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 ha sido declarada EXPERIMENTAL. Su funcionamiento, nombre y la documentación que le acompaña puede cambiar sin previo aviso en futuras versiones de PHP. Utilícela bajo su propia responsabilidad.

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
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