reference/url/functions/get-headers.xml
943c1285bd3808ad764f01da00b59458110133c0
...
...
@@ -9,10 +9,10 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>array</type><methodname>get_headers</methodname>
12
+
<type class="union"><type>array</type><type>false</type></type><methodname>get_headers</methodname>
13
13
<methodparam><type>string</type><parameter>url</parameter></methodparam>
14
-
<methodparam choice="opt"><type>int</type><parameter>format</parameter><initializer>0</initializer></methodparam>
15
-
<methodparam choice="opt"><type>resource</type><parameter>context</parameter></methodparam>
14
+
<methodparam choice="opt"><type>bool</type><parameter>associative</parameter><initializer>&false;</initializer></methodparam>
15
+
<methodparam choice="opt"><type class="union"><type>resource</type><type>null</type></type><parameter>context</parameter><initializer>&null;</initializer></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
<function>get_headers</function> returns an array with the headers sent
...
...
@@ -33,10 +33,10 @@
33
33
</listitem>
34
34
</varlistentry>
35
35
<varlistentry>
36
-
<term><parameter>format</parameter></term>
36
+
<term><parameter>associative</parameter></term>
37
37
<listitem>
38
38
<para>
39
-
If the optional <parameter>format</parameter> parameter is set to non-zero,
39
+
If the optional <parameter>associative</parameter> parameter is set to true,
40
40
<function>get_headers</function> parses the response and sets the
41
41
array's keys.
42
42
</para>
...
...
@@ -47,7 +47,8 @@
47
47
<listitem>
48
48
<para>
49
49
A valid context resource created with
50
-
<function>stream_context_create</function>.
50
+
<function>stream_context_create</function>, or &null; to use the
51
+
default context.
51
52
</para>
52
53
</listitem>
53
54
</varlistentry>
...
...
@@ -76,17 +77,15 @@
76
77
</thead>
77
78
<tbody>
78
79
<row>
79
-
<entry>7.1.0</entry>
80
+
<entry>8.0.0</entry>
80
81
<entry>
81
-
The <parameter>context</parameter> parameter was added.
82
+
The <parameter>associative</parameter> has been changed from <type>int</type> to <type>bool</type>.
82
83
</entry>
83
84
</row>
84
85
<row>
85
-
<entry>5.1.3</entry>
86
+
<entry>7.1.0</entry>
86
87
<entry>
87
-
This function now uses the default stream context, which can be
88
-
set/changed with the <function>stream_context_set_default</function>
89
-
function.
88
+
The <parameter>context</parameter> parameter was added.
90
89
</entry>
91
90
</row>
92
91
</tbody>
...
...
@@ -107,7 +106,7 @@ $url = 'http://www.example.com';
107
106

108
107
print_r(get_headers($url));
109
108

110
-
print_r(get_headers($url, 1));
109
+
print_r(get_headers($url, true));
111
110
?>
112
111
]]>
113
112
</programlisting>
...
...
@@ -149,14 +148,14 @@ Array
149
148
<?php
150
149
// By default get_headers uses a GET request to fetch the headers. If you
151
150
// want to send a HEAD request instead, you can do so using a stream context:
152
-
stream_context_set_default(
153
-
array(
151
+
$context = stream_context_create(
152
+
[
154
153
'http' => array(
155
154
'method' => 'HEAD'
156
155
)
157
-
)
156
+
]
158
157
);
159
-
$headers = get_headers('http://example.com');
158
+
$headers = get_headers('http://example.com', false, $context);
160
159
?>
161
160
]]>
162
161
</programlisting>
...
...
@@ -174,7 +173,6 @@ $headers = get_headers('http://example.com');
174
173
</refsect1>
175
174

176
175
</refentry>
177
-

178
176
<!-- Keep this comment at the end of the file
179
177
Local variables:
180
178
mode: sgml
181
179