mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-25 17:32:07 +01:00
323 lines
8.1 KiB
XML
323 lines
8.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: cf3707c0f4aab3f7d4d9bfef40827375a6007c0b Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: yes -->
|
|
<refentry xml:id="function.stream-get-meta-data" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>stream_get_meta_data</refname>
|
|
<refpurpose>Lit les en-têtes et données méta des flux</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>stream_get_meta_data</methodname>
|
|
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Retourne les informations disponibles sur le flux <parameter>stream</parameter>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>stream</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Le flux peut être n'importe quel flux créé par les fonctions
|
|
<function>fopen</function>, <function>fsockopen</function>,
|
|
<function>pfsockopen</function> et <function>stream_socket_client</function>..
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Le tableau résultant peut contenir les éléments suivants :
|
|
</para>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
<literal>timed_out</literal> (&boolean;) : &true; si le flux
|
|
a atteint de délai d'expiration en attendant des données
|
|
durant le dernier appel aux fonctions <function>fread</function>
|
|
et <function>fgets</function>.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>blocked</literal> (&boolean;) : &true; si le flux est en
|
|
mode bloquant. Voir aussi <function>stream_set_blocking</function>.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>eof</literal> (&boolean;) : &true; si le flux a atteint la
|
|
fin du fichier. Notez que pour les sockets, cette valeur peut être
|
|
&true; même si <literal>unread_bytes</literal> est non nul. Pour
|
|
déterminer s'il reste des données à lire, utilisez plutôt la
|
|
fonction <function>feof</function>.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>unread_bytes</literal> (&integer;) : le nombre d'octets
|
|
actuellement placés dans le buffer interne à PHP.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Vous ne devriez pas utiliser cette valeur dans un script.
|
|
</simpara>
|
|
</note>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>stream_type</literal> (&string;) : un nom, qui
|
|
décrit l'implémentation sous-jacente de flux.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>wrapper_type</literal> (&string;) : un nom qui décrit
|
|
le gestionnaire de protocole pour ce flux. Voyez
|
|
<xref linkend="wrappers"/> pour plus d'informations sur les
|
|
gestionnaires.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>wrapper_data</literal> (mixed) : des données spécifiques
|
|
au gestionnaire liés à ce flux. Voyez <xref linkend="wrappers"/> pour
|
|
plus d'informations sur les gestionnaires et leurs données.
|
|
</para>
|
|
</listitem>
|
|
<!-- {{{ needs updating when stream filters are included again
|
|
<listitem>
|
|
<para>
|
|
<literal>filters</literal> (&array;) : un tableau contenant les
|
|
noms de tous les filtres qui ont été attachés à ce flux.
|
|
La documentation sur les filtres peut être trouvée sur
|
|
l'<link linkend="filters">annexe concernant les filtres</link>.
|
|
</para>
|
|
</listitem>
|
|
-->
|
|
<listitem>
|
|
<para>
|
|
<literal>mode</literal> (&string;) : le type d'accès requis pour ce flux
|
|
( voir le tableau 1 de la référence de la fonction <link
|
|
linkend="function.fopen"><function>fopen</function></link>)
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>seekable</literal> (&boolean;) : si on peut rechercher dans
|
|
le flux courant.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>uri</literal> (&string;) : l'URI/nom de fichier associé à
|
|
ce flux.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
<literal>crypto</literal> (&array;) - les métadonnées de la connexion TLS
|
|
pour ce flux. (Note: Seulement fournit quand la ressource de flux utilise TLS.)
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemple de <function>stream_get_meta_data</function> utilisant <function>fopen</function> avec http</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$url = 'http://www.example.com/';
|
|
|
|
if (!$fp = fopen($url, 'r')) {
|
|
trigger_error("Unable to open URL ($url)", E_USER_ERROR);
|
|
}
|
|
|
|
$meta = stream_get_meta_data($fp);
|
|
|
|
var_dump($meta);
|
|
|
|
fclose($fp);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
array(10) {
|
|
'timed_out' =>
|
|
bool(false)
|
|
'blocked' =>
|
|
bool(true)
|
|
'eof' =>
|
|
bool(false)
|
|
'wrapper_data' =>
|
|
array(13) {
|
|
[0] =>
|
|
string(15) "HTTP/1.1 200 OK"
|
|
[1] =>
|
|
string(11) "Age: 244629"
|
|
[2] =>
|
|
string(29) "Cache-Control: max-age=604800"
|
|
[3] =>
|
|
string(38) "Content-Type: text/html; charset=UTF-8"
|
|
[4] =>
|
|
string(35) "Date: Sat, 20 Nov 2021 18:17:57 GMT"
|
|
[5] =>
|
|
string(24) "Etag: "3147526947+ident""
|
|
[6] =>
|
|
string(38) "Expires: Sat, 27 Nov 2021 18:17:57 GMT"
|
|
[7] =>
|
|
string(44) "Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT"
|
|
[8] =>
|
|
string(22) "Server: ECS (chb/0286)"
|
|
[9] =>
|
|
string(21) "Vary: Accept-Encoding"
|
|
[10] =>
|
|
string(12) "X-Cache: HIT"
|
|
[11] =>
|
|
string(20) "Content-Length: 1256"
|
|
[12] =>
|
|
string(17) "Connection: close"
|
|
}
|
|
'wrapper_type' =>
|
|
string(4) "http"
|
|
'stream_type' =>
|
|
string(14) "tcp_socket/ssl"
|
|
'mode' =>
|
|
string(1) "r"
|
|
'unread_bytes' =>
|
|
int(1256)
|
|
'seekable' =>
|
|
bool(false)
|
|
'uri' =>
|
|
string(23) "http://www.example.com/"
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Exemple de <function>stream_get_meta_data</function> utilisant <function>stream_socket_client</function> avec https</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$streamContext = stream_context_create(
|
|
[
|
|
'ssl' => [
|
|
'capture_peer_cert' => true,
|
|
'capture_peer_cert_chain' => true,
|
|
'disable_compression' => true,
|
|
],
|
|
]
|
|
);
|
|
|
|
$client = stream_socket_client(
|
|
'ssl://www.example.com:443',
|
|
$errorNumber,
|
|
$errorDescription,
|
|
40,
|
|
STREAM_CLIENT_CONNECT,
|
|
$streamContext
|
|
);
|
|
|
|
|
|
$meta = stream_get_meta_data($client);
|
|
|
|
var_dump($meta);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
array(8) {
|
|
'crypto' =>
|
|
array(4) {
|
|
'protocol' =>
|
|
string(7) "TLSv1.3"
|
|
'cipher_name' =>
|
|
string(22) "TLS_AES_256_GCM_SHA384"
|
|
'cipher_bits' =>
|
|
int(256)
|
|
'cipher_version' =>
|
|
string(7) "TLSv1.3"
|
|
}
|
|
'timed_out' =>
|
|
bool(false)
|
|
'blocked' =>
|
|
bool(true)
|
|
'eof' =>
|
|
bool(false)
|
|
'stream_type' =>
|
|
string(14) "tcp_socket/ssl"
|
|
'mode' =>
|
|
string(2) "r+"
|
|
'unread_bytes' =>
|
|
int(0)
|
|
'seekable' =>
|
|
bool(false)
|
|
}
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
Cette fonction ne fonctionne pas sur les sockets créées avec
|
|
<link linkend="ref.sockets">l'extension socket</link>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>get_headers</function></member>
|
|
<member><link linkend="reserved.variables.httpresponseheader">$http_response_header</link></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
|
|
-->
|