PHP 8.3.4 Released!

xmlrpc_is_fault

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

xmlrpc_is_faultDetermina se um valor de array representa uma falha XML-RPC

Descrição

xmlrpc_is_fault(array $arg): bool
Aviso

Esta função é EXPERIMENTAL. O comportamento desta função, seu nome e documentação poderão mudar sem aviso prévio em futuras versões do PHP. Use por sua conta e risco.

Parâmetros

arg

Array retornado por xmlrpc_decode().

Valor Retornado

Retorna true se o argumento significa falha, false caso contrário. Descrição da falha está disponível em $arg["faultString"], código da falha está em $arg["faultCode"].

Exemplos

Veja o exemplo em xmlrpc_encode_request().

Veja Também

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