1--TEST-- 2Test get_headers() function : test with context 3--FILE-- 4<?php 5 6include dirname(__FILE__)."/../../../../sapi/cli/tests/php_cli_server.inc"; 7php_cli_server_start('header("X-Request-Method: ".$_SERVER["REQUEST_METHOD"]);'); 8 9$opts = array( 10 'http' => array( 11 'method' => 'HEAD' 12 ) 13); 14 15$context = stream_context_create($opts); 16$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1, $context); 17echo $headers["X-Request-Method"]."\n"; 18 19stream_context_set_default($opts); 20$headers = get_headers("http://".PHP_CLI_SERVER_ADDRESS, 1); 21echo $headers["X-Request-Method"]."\n"; 22 23echo "Done"; 24?> 25--EXPECT-- 26HEAD 27HEAD 28Done 29