<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.xmlrpc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.xmlrpc-encode-request.php',
    1 => 'xmlrpc_encode_request',
    2 => 'G&eacute;n&egrave;re le XML pour une requ&ecirc;te de m&eacute;thode',
  ),
  'up' => 
  array (
    0 => 'ref.xmlrpc.php',
    1 => 'Fonctions XML-RPC',
  ),
  'prev' => 
  array (
    0 => 'function.xmlrpc-encode.php',
    1 => 'xmlrpc_encode',
  ),
  'next' => 
  array (
    0 => 'function.xmlrpc-get-type.php',
    1 => 'xmlrpc_get_type',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/xmlrpc/functions/xmlrpc-encode-request.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.xmlrpc-encode-request" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xmlrpc_encode_request</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.1.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">xmlrpc_encode_request</span> &mdash; <span class="dc-title">Génère le XML pour une requête de méthode</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.xmlrpc-encode-request-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">function</span> <span class="methodname"><strong>xmlrpc_encode_request</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$method</code></span>, <span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$params</code></span>, <span class="methodparam"><span class="type"><a href="language.types.array.php" class="type array">array</a></span> <code class="parameter">$output_options</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <div class="warning"><strong class="warning">Avertissement</strong><p class="simpara">
 Cette fonction est <em>EXPERIMENTALE</em>. Le comportement de cette fonction, son nom, et toute la
 documentation autour de cette fonction peuvent changer sans préavis dans une prochaine version de PHP.
 Cette fonction doit être utilisée aux risques et périls de l&#039;utilisateur.
</p></div>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.xmlrpc-encode-request-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">method</code></dt>
     <dd>
      <p class="para">
       Nom de la méthode à appeler.
      </p>
     </dd>
    
    
     <dt><code class="parameter">params</code></dt>
     <dd>
      <p class="para">
       Paramètres de la méthode, compatibles avec la signature de la méthode.
      </p>
     </dd>
    
    
     <dt><code class="parameter">output_options</code></dt>
     <dd>
      <p class="para">
       Tableau spécifiant les options de sortie pouvant contenir (les valeurs
       par défaut sont en gras) :
       <ul class="itemizedlist">
        <li class="listitem"><p class="para">output_type: php, <em>xml</em></p></li>
        <li class="listitem"><p class="para">verbosity: no_white_space, newlines_only, <em>pretty</em></p></li>
        <li class="listitem"><p class="para">escaping: cdata, <em>non-ascii, non-print, markup</em>
          (peut être une chaîne avec une valeur ou un tableau avec plusieurs valeurs)</p></li>
        <li class="listitem"><p class="para">version: simple, <em>xmlrpc</em>, soap 1.1, auto</p></li>
        <li class="listitem"><p class="para">encoding: <em>iso-8859-1</em>, autres jeux de caractères supportés par iconv</p></li>
       </ul>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xmlrpc-encode-request-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne une chaîne contenant la représentation XML de la demande.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.xmlrpc-encode-request-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec XMLRPC</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><code style="color: #000000"><span style="color: #0000BB">&lt;?php
$request </span><span style="color: #007700">= </span><span style="color: #0000BB">xmlrpc_encode_request</span><span style="color: #007700">(</span><span style="color: #DD0000">"method"</span><span style="color: #007700">, [</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">]);
</span><span style="color: #0000BB">$context </span><span style="color: #007700">= </span><span style="color: #0000BB">stream_context_create</span><span style="color: #007700">([
    </span><span style="color: #DD0000">'http' </span><span style="color: #007700">=&gt; [
        </span><span style="color: #DD0000">'method'  </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"POST"</span><span style="color: #007700">,
        </span><span style="color: #DD0000">'header'  </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">"Content-Type: text/xml"</span><span style="color: #007700">,
        </span><span style="color: #DD0000">'content' </span><span style="color: #007700">=&gt; </span><span style="color: #0000BB">$request</span><span style="color: #007700">,
    ]
]);
</span><span style="color: #0000BB">$file </span><span style="color: #007700">= </span><span style="color: #0000BB">file_get_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">"http://www.example.com/xmlrpc"</span><span style="color: #007700">, </span><span style="color: #0000BB">false</span><span style="color: #007700">, </span><span style="color: #0000BB">$context</span><span style="color: #007700">);
</span><span style="color: #0000BB">$response </span><span style="color: #007700">= </span><span style="color: #0000BB">xmlrpc_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$file</span><span style="color: #007700">);
if (</span><span style="color: #0000BB">$response </span><span style="color: #007700">&amp;&amp; </span><span style="color: #0000BB">xmlrpc_is_fault</span><span style="color: #007700">(</span><span style="color: #0000BB">$response</span><span style="color: #007700">)) {
    </span><span style="color: #0000BB">trigger_error</span><span style="color: #007700">(</span><span style="color: #DD0000">"xmlrpc: </span><span style="color: #0000BB">$response</span><span style="color: #007700">[</span><span style="color: #0000BB">faultString</span><span style="color: #007700">]</span><span style="color: #DD0000"> (</span><span style="color: #0000BB">$response</span><span style="color: #007700">[</span><span style="color: #0000BB">faultCode</span><span style="color: #007700">]</span><span style="color: #DD0000">)"</span><span style="color: #007700">);
} else {
    </span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$response</span><span style="color: #007700">);
}
</span><span style="color: #0000BB">?&gt;</span></code></pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.xmlrpc-encode-request-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.stream-context-create.php" class="function" rel="rdfs-seeAlso">stream_context_create()</a> - Cr&eacute;e un contexte de flux</span></li>
    <li><span class="function"><a href="function.file-get-contents.php" class="function" rel="rdfs-seeAlso">file_get_contents()</a> - Lit tout un fichier dans une cha&icirc;ne</span></li>
    <li><span class="function"><a href="function.xmlrpc-decode.php" class="function" rel="rdfs-seeAlso">xmlrpc_decode()</a> - D&eacute;code le XML en types PHP natifs</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>