<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.xmlrpc-encode-request" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>xmlrpc_encode_request</refname>
  <refpurpose>Generates XML for a method request</refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>string</type><methodname>xmlrpc_encode_request</methodname>
   <methodparam><type>string</type><parameter>method</parameter></methodparam>
   <methodparam><type>mixed</type><parameter>params</parameter></methodparam>
   <methodparam choice="opt"><type>array</type><parameter>output_options</parameter></methodparam>
  </methodsynopsis>
  &warn.experimental.func;
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>method</parameter></term>
     <listitem>
      <para>
       Name of the method to call.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>params</parameter></term>
     <listitem>
      <para>
       Method parameters compatible with method signature.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>output_options</parameter></term>
     <listitem>
      <para>
       Array specifying output options may contain (default values are
       emphasised):
       <itemizedlist>
        <listitem><para>output_type: php, <emphasis>xml</emphasis></para></listitem>
        <listitem><para>verbosity: no_white_space, newlines_only, <emphasis>pretty</emphasis></para></listitem>
        <listitem><para>escaping: cdata, <emphasis>non-ascii, non-print, markup</emphasis>
          (may be a string with one value or an array with multiple values)</para></listitem>
        <listitem><para>version: simple, <emphasis>xmlrpc</emphasis>, soap 1.1, auto</para></listitem>
        <listitem><para>encoding: <emphasis>iso-8859-1</emphasis>, other character set supported by iconv</para></listitem>
       </itemizedlist>
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns a string containing the XML representation of the request.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>XMLRPC client functions example</title>
    <programlisting role="php">
<![CDATA[
<?php
$request = xmlrpc_encode_request("method", array(1, 2, 3));
$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml",
    'content' => $request
)));
$file = file_get_contents("http://www.example.com/xmlrpc", false, $context);
$response = xmlrpc_decode($file);
if ($response && xmlrpc_is_fault($response)) {
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
    print_r($response);
}
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>stream_context_create</function></member>
    <member><function>file_get_contents</function></member>
    <member><function>xmlrpc_decode</function></member>
   </simplelist>
  </para>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
