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 — Determines if an array value represents an XMLRPC fault
Opis
bool xmlrpc_is_fault
( array
$arg
)Ostrzeżenie
Ta funkcja jest w stadium EKSPERYMENTALNYM. Oznacza to, że zachowanie funkcji, jej nazwa, w zasadzie wszystko udokumentowane tutaj może zostać zmienione w przyszłych wersjach PHP bez wcześniejszego uprzedzenia. Używaj tej funkcji na własne ryzyko.
Zwracane wartości
Returns TRUE if the argument means fault, FALSE otherwise. Fault
description is available in $arg["faultString"], fault
code is in $arg["faultCode"].
Przykłady
See example by xmlrpc_encode_request().
angelo at at dot com
25-Jan-2011 12:31
