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 — Bir dizinin bir XMLRPC hatasını gösterip göstermediğini tespit eder
Açıklama
bool xmlrpc_is_fault
( array
$dizi
)Uyarı
Bu işlev DENEYSELDİR. Bu işlevin davranışı, ismi ve belgeleri PHP'nin sonraki sürümlerinde hiçbir duyuru yapılmaksızın değiştirilebilir. Bu riski göze alamayacaksanız bu işlevi kullanmayın.
Dönen Değerler
$dizi bir hata içeriyorsa TRUE, aksi takdirde FALSE
döner. Hatanın koduna $dizi["faultCode"], açıklamasına
ise $dizi["faultString"] ile erişilir.
Örnekler
xmlrpc_encode_request() işlevindeki örneğe bakınız.
angelo at at dot com ¶
2 years ago
