Services_Blogging
[ class tree: Services_Blogging ] [ index: Services_Blogging ] [ all elements ]

Source for file XmlRpc.php

Documentation is available at XmlRpc.php

  1. <?php
  2. require_once 'Services/Blogging/Exception.php';
  3. require_once 'XML/RPC.php';
  4.  
  5. /**
  6. *   XmlRpc helper methods for the blogging API
  7. *
  8. *   @category    Services
  9. *   @package     Services_Blogging
  10. *   @author      Anant Narayanan <anant@php.net>
  11. *   @author      Christian Weiske <cweiske@php.net>
  12. *   @license     http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
  13. */
  14. {
  15.     /**
  16.      * The function that actually sends an XML-RPC request to the server, handles
  17.      * errors accordingly and returns the appropriately decoded data sent as response
  18.      * from the server.
  19.      *
  20.      * @param   XML_RPC_Message $request    An appropriately encoded XML-RPC message
  21.      *                                       that needs to be sent as a request to the
  22.      *                                       server.
  23.      * @param   XML_RPC_Client  $client     The XML-RPC client as which the request
  24.      *                                       is to be sent.
  25.      *
  26.      * @return  Array   The appropriately decoded response sent by the server.
  27.      */
  28.     public static function sendRequest($request$client)
  29.     {
  30.         $response $client->send($request);
  31.         if (!$response{
  32.             throw new Services_Blogging_Exception('XML-RPC communication error: ' $client->errstr);
  33.         else if ($response->faultCode(!= 0{
  34.             throw new Services_Blogging_Exception(
  35.                 $response->faultString(),
  36.                 $response->faultCode()
  37.             );
  38.         }
  39.  
  40.         $value = XML_RPC_Decode($response->value());
  41.         if (!is_array($value|| !isset($value['faultCode'])) {
  42.             return $value;
  43.         else {
  44.             throw new Services_Blogging_Exception($value['faultString']$value['faultCode']);
  45.         }
  46.     }//public static function sendRequest($request, $client)
  47.  
  48. }//class Services_Blogging_XmlRpc
  49. ?>

Documentation generated on Mon, 11 Mar 2019 14:57:59 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.