1--TEST-- 2$http_reponse_header (redirect + not found) 3--SKIPIF-- 4<?php require 'server.inc'; http_server_skipif(); ?> 5--INI-- 6allow_url_fopen=1 7--FILE-- 8<?php 9require 'server.inc'; 10 11$responses = array( 12 "data://text/plain,HTTP/1.0 302 Found\r\n" 13 . "Some: Header\r\nLocation: /try-again\r\n\r\n", 14 "data://test/plain,HTTP/1.0 404 Not Found\r\nSome: Header\r\n\r\nBody", 15); 16 17['pid' => $pid, 'uri' => $uri] = http_server($responses, $output); 18 19var_dump(http_get_last_response_headers()); 20 21$f = file_get_contents($uri); 22var_dump($f); 23var_dump($http_response_header); 24var_dump(http_get_last_response_headers()); 25 26http_server_kill($pid); 27 28?> 29--EXPECTF-- 30NULL 31 32Warning: file_get_contents(http://%s:%d): Failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found%a 33bool(false) 34array(5) { 35 [0]=> 36 string(18) "HTTP/1.0 302 Found" 37 [1]=> 38 string(12) "Some: Header" 39 [2]=> 40 string(20) "Location: /try-again" 41 [3]=> 42 string(22) "HTTP/1.0 404 Not Found" 43 [4]=> 44 string(12) "Some: Header" 45} 46array(5) { 47 [0]=> 48 string(18) "HTTP/1.0 302 Found" 49 [1]=> 50 string(12) "Some: Header" 51 [2]=> 52 string(20) "Location: /try-again" 53 [3]=> 54 string(22) "HTTP/1.0 404 Not Found" 55 [4]=> 56 string(12) "Some: Header" 57} 58