Skip to content

PHP-8.4: Document http_(get|clear)_last_response_headers() functions #4034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions language/predefined/variables/httpresponseheader.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry role="variable" xml:id="reserved.variables.httpresponseheader" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>$http_response_header</refname>
<refpurpose>HTTP response headers</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<para>
Expand Down Expand Up @@ -67,9 +66,16 @@ NULL
</example>
</para>
</refsect1>


<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>http_get_last_response_headers</function></member>
<member><function>http_clear_last_response_headers</function></member>
</simplelist>
</refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
Expand All @@ -90,4 +96,3 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

59 changes: 59 additions & 0 deletions reference/network/functions/http-clear-last-response-headers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="function.http-clear-last-response-headers" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>http_clear_last_response_headers</refname>
<refpurpose>Clears the stored HTTP response headers</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>void</type><methodname>http_clear_last_response_headers</methodname>
<void/>
</methodsynopsis>
<simpara>
Clears the <acronym>HTTP</acronym> response headers that were received using
the <link linkend="wrappers.http">HTTP wrapper</link>.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
&return.void;
</simpara>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>http_get_last_response_headers</function></member>
</simplelist>
</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
-->
117 changes: 117 additions & 0 deletions reference/network/functions/http-get-last-response-headers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<refentry xml:id="function.http-get-last-response-headers" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>http_get_last_response_headers</refname>
<refpurpose>Retrieve last HTTP response headers</refpurpose>
</refnamediv>

<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>array</type><type>null</type></type><methodname>http_get_last_response_headers</methodname>
<void/>
</methodsynopsis>
<simpara>
Returns an <type>array</type> containing the last <acronym>HTTP</acronym>
response headers received via the
<link linkend="wrappers.http">HTTP wrapper</link>.
If there are none, &null; is returned instead.
</simpara>
</refsect1>

<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>

<refsect1 role="returnvalues">
&reftitle.returnvalues;
<simpara>
Returns an indexed <type>array</type> of <acronym>HTTP</acronym> headers
which were received while using the
<link linkend="wrappers.http">HTTP wrapper</link>.
If there are none, &null; is returned instead.
</simpara>
</refsect1>

<refsect1 role="examples">
&reftitle.examples;
<example xml:id="function.http-get-last-response-headers.example.basic">
<title><function>http_get_last_response_headers</function> example</title>
<simpara>
Description.
</simpara>
<programlisting role="php">
<![CDATA[
<?php
file_get_contents("http://example.com");
var_dump(http_get_last_response_headers());
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
array(14) {
[0]=>
string(15) "HTTP/1.1 200 OK"
[1]=>
string(20) "Accept-Ranges: bytes"
[2]=>
string(11) "Age: 326940"
[3]=>
string(29) "Cache-Control: max-age=604800"
[4]=>
string(38) "Content-Type: text/html; charset=UTF-8"
[5]=>
string(35) "Date: Mon, 11 Nov 2024 13:34:09 GMT"
[6]=>
string(23) "Etag: "3147526947+gzip""
[7]=>
string(38) "Expires: Mon, 18 Nov 2024 13:34:09 GMT"
[8]=>
string(44) "Last-Modified: Thu, 17 Oct 2019 07:18:26 GMT"
[9]=>
string(24) "Server: ECAcc (nyd/D16C)"
[10]=>
string(21) "Vary: Accept-Encoding"
[11]=>
string(12) "X-Cache: HIT"
[12]=>
string(20) "Content-Length: 1256"
[13]=>
string(17) "Connection: close"
}
]]>
</screen>
</example>
</refsect1>

<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><function>http_clear_last_response_headers</function></member>
</simplelist>
</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
-->
2 changes: 2 additions & 0 deletions reference/network/versions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<function name="header_remove" from="PHP 5 &gt;= 5.3.0, PHP 7, PHP 8"/>
<function name="headers_list" from="PHP 5, PHP 7, PHP 8"/>
<function name="headers_sent" from="PHP 4, PHP 5, PHP 7, PHP 8"/>
<function name="http_clear_last_response_headers" from="PHP 8 &gt;= 8.4.0"/>
<function name="http_get_last_response_headers" from="PHP 8 &gt;= 8.4.0"/>
<function name="http_response_code" from="PHP 5 &gt;= 5.4.0, PHP 7, PHP 8"/>
<function name="inet_ntop" from="PHP 5 &gt;= 5.1.0, PHP 7, PHP 8"/>
<function name="inet_pton" from="PHP 5 &gt;= 5.1.0, PHP 7, PHP 8"/>
Expand Down