summaryrefslogtreecommitdiff
path: root/ext/standard/tests/url/get_headers_error_003.phpt
blob: a8edc2cb21bf10dc17c82c083a98e02a9e77fb15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--TEST--
Test get_headers() function : test with context
--CONFLICTS--
server
--FILE--
<?php

include __DIR__."/../../../../sapi/cli/tests/php_cli_server.inc";
php_cli_server_start('header("X-Request-Method: ".$_SERVER["REQUEST_METHOD"]);');

$opts = array(
  'http' => array(
    'method' => 'HEAD'
  )
);

$context = stream_context_create($opts);
$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1, $context);
echo $headers["X-Request-Method"]."\n";

stream_context_set_default($opts);
$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1);
echo $headers["X-Request-Method"]."\n";

echo "Done";
?>
--EXPECT--
HEAD
HEAD
Done