mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-26 09:52:17 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@260769 c90b9560-bf6c-de11-be94-00142212c4b1
110 lines
2.7 KiB
XML
110 lines
2.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.5 $ -->
|
|
<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
<refentry xml:id="function.httprequest-send" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>HttpRequest::send</refname>
|
|
<refpurpose>Envoi une requête</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier>
|
|
<type>HttpMessage</type><methodname>HttpRequest::send</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
Envoi une requête HTTP.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Bien qu'une exception peut avoir été lancée, le transfert peut avoir réussi,
|
|
au moins, partiellement, vous devriez donc vérifier les valeurs retournées
|
|
des différentes méthodes HttpRequest::getResponse*().
|
|
</para>
|
|
</note>
|
|
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Retourne la réponse reçue sous la forme d'un objet HttpMessage.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Lance une exception HttpRuntimeException, HttpRequestException, HttpMalformedHeaderException ou
|
|
HttpEncodingException.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple GET</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$r = new HttpRequest('http://example.com/feed.rss', HttpRequest::METH_GET);
|
|
$r->setOptions(array('lastmodified' => filemtime('local.rss')));
|
|
$r->addQueryData(array('category' => 3));
|
|
try {
|
|
$r->send();
|
|
if ($r->getResponseCode() == 200) {
|
|
file_put_contents('local.rss', $r->getResponseBody());
|
|
}
|
|
} catch (HttpException $ex) {
|
|
echo $ex;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Exemple POST</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$r = new HttpRequest('http://example.com/form.php', HttpRequest::METH_POST);
|
|
$r->setOptions(array('cookies' => array('lang' => 'de')));
|
|
$r->addPostFields(array('user' => 'mike', 'pass' => 's3c|r3t'));
|
|
$r->addPostFile('image', 'profile.jpg', 'image/jpeg');
|
|
try {
|
|
echo $r->send()->getBody();
|
|
} catch (HttpException $ex) {
|
|
echo $ex;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</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:"../../../../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
|
|
--> |