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