PHP使ってないけど、友達から聞かれたので調べてみた。
<?php
PHP: $http_response_header - Manual
file_get_contents("http://example.com");
var_dump($http_response_header);
?>
でいいみたい。ちょっと試してみたいけど、実行環境がないなと思っていたら、そうだ「lleval」があった!
lleval - run codes from your browser に行って、phpを選んで上のコードをはっつけて「eval」ると、
lang php status 0 stderr stdout array(9) { [0]=> string(15) "HTTP/1.1 200 OK" [1]=> string(35) "Date: Mon, 15 Jun 2009 14:08:23 GMT" [2]=> string(29) "Server: Apache/2.2.3 (CentOS)" [3]=> string(44) "Last-Modified: Tue, 15 Nov 2005 13:24:10 GMT" [4]=> string(26) "ETag: "b80f4-1b6-80bfd280"" [5]=> string(20) "Accept-Ranges: bytes" [6]=> string(19) "Content-Length: 438" [7]=> string(17) "Connection: close" [8]=> string(38) "Content-Type: text/html; charset=UTF-8" } syscalls 295 time 0.401423931121826
おお〜、便利!
Last-Modified がとれとる。