Appendix D: XML-RPC for PHP


eXtensible Markup Language-Remote Procedure Calls (XML-RPC) is an XML-based protocol that lets you make remote procedure calls over the Internet. XML-RPC is encoded in XML, and uses HTTP to transfer the client requests and receive the responses from a server. You can transfer complex data over the Internet using XML-RPC.

Using XML-RPC, you can integrate and develop a Hypertext Preprocessor (PHP) Web application. XML-RPC involves the process in which the server provides procedures to call the clients . The calling program transfers a message to the remote program, which executes the procedure specified in the message and returns the result to the calling program. The XML-RPC implementation provides various basic RPC functions, such as xmlrpc_decode_request() and xmlrpc_encode_request(), which enables you to make procedure calls in HTTPS. XML-RPC also provides utility functions for the conversion of the PHP and XML-RPC data types.

This appendix describes various XML-RPC and utility functions.

XML-RPC Functions

Using XML-RPC functions, you can create XML-RPC clients and servers. The XML-RPC functions are:

  • xmlrpc_decode_request() : Decodes XML strings into native PHP types. The syntax of the xmlrpc_decode_request () function is:

     array xmlrpc_decode_request (string xml, string method [, string encoding]) 
  • xmlrpc_encode_request() : Generates the XML language for a method request. The syntax of the xmlrpc_encode_request() function is:

     string xmlrpc_encode_request (string method, mixed params) 
  • xmlrpc_get_type() : Retrieves the xmlrpc data type for a PHP value. The syntax of the xmlrpc_encode_request() function is:

     string xmlrpc_get_type (mixed value) 
  • xmlrpc_parse_method_descriptions() : Decodes the XML language into a list of method descriptions. The syntax of the xmlrpc_parse_method_descriptions function is:

     array xmlrpc_parse_method_descriptions ( string xml) 
  • xmlrpc_server_call_method() : Parses the XML requests. The syntax of the xmlrpc_server_call_method() function is:

     mixed xmlrpc_server_call_method (resource server, string xml, mixed user_data [, array output_options]) 
  • xmlrpc_server_create() : Creates an xmlrpc server. The syntax of the xmlrpc_server_create() function is:

     resource xmlrpc_server_create (void) 
  • xmlrpc_server_destroy() : Destroys the server resources. The syntax of the xmlrpc_server_destroy() function is:

     void xmlrpc_server_destroy (resource server) 
  • xmlrpc_server_register_method() : Registers a PHP function to a resource method matching the methodspecified as argument in the xmlrpc_server_register_method () function. The syntax of the xmlrpc_server_register_method() function is:

     bool xmlrpc_server_register_method (resource server, string methodName, string function) 
  • xmlrpc_set_type() : Specifies the xmlrpc data type, or datetime, for a PHP string value. The syntax of the xmlrpc_set_type() function is:

     bool xmlrpc_set_type (string value, string type) 



Integrating PHP and XML 2004
Integrating PHP and XML 2004
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 51

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net