reference/url/functions/get-headers.xml
943c1285bd3808ad764f01da00b59458110133c0
...
...
@@ -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>
...
...
@@ -147,14 +148,14 @@ Array
147
148
<?php
148
149
// By default get_headers uses a GET request to fetch the headers. If you
149
150
// want to send a HEAD request instead, you can do so using a stream context:
150
-
stream_context_set_default(
151
-
array(
151
+
$context = stream_context_create(
152
+
[
152
153
'http' => array(
153
154
'method' => 'HEAD'
154
155
)
155
-
)
156
+
]
156
157
);
157
-
$headers = get_headers('http://example.com');
158
+
$headers = get_headers('http://example.com', false, $context);
158
159
?>
159
160
]]>
160
161
</programlisting>
...
...
@@ -172,7 +173,6 @@ $headers = get_headers('http://example.com');
172
173
</refsect1>
173
174

174
175
</refentry>
175
-

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