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']);
}
?>
xmlrpc_is_fault
(PHP 4 >= 4.3.0, PHP 5)
xmlrpc_is_fault — Determina si el valor de un arreglo representa una falla del XMLRPC
Descripción
bool xmlrpc_is_fault
( array
$arg
)Advertencia
Esta función ha sido declarada EXPERIMENTAL. Su comportamiento, su nombre y la documentación que le acompaña puede cambiar sin previo aviso en futuras versiones de PHP. Use esta función bajo su propio riesgo.
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 de xmlrpc_encode_request().
angelo at at dot com ¶
2 years ago
