<?php $fp = fopen('http://www.sample.com/index.html', 'r'); $meta = stream_get_meta_data($fp)); var_dump($meta); ?>
この出力例は、
Array ( [wrapper_data] => Array ( [0] => HTTP/1.1 200 OK [1] => Server: Zeus/4.3 [2] => Date: Thu, 06 Oct 2011 23:08:18 GMT [3] => Connection: close [4] => Content-Length: 446990 [5] => Accept-Ranges: bytes [6] => Content-Type: text/html [7] => Last-Modified: Wed, 05 Oct 2011 23:07:49 GMT ) [wrapper_type] => http [stream_type] => tcp_socket/ssl [mode] => r [unread_bytes] => 0 [seekable] => [uri] => http://www.sample.com/index.html [timed_out] => [blocked] => 1 [eof] => )
こんな感じ。むろんサーバによって異なるので注意。で Last-Modified 部分をタイムスタンプにしてみる。
strtotime(preg_replace('|^Last-Modified: |', '', $meta['wrapper_data'][7]);
とかしておけば。