You are here: Re: If-modified-since HTTP compliant! « PHP Programming Language « IT news, forums, messages
Re: If-modified-since HTTP compliant!

Posted by Janwillem Borleffs on 10/31/43 11:23

Chris wrote:
> is there a HTTP-compliant implementation of If-Modified-Since-,
> If-Match, If-None-Match, If-Range and so on?
>
> I want my PHP-script to act exactly as if it was a static HTML-page
> delivered directly from Apache.
>
> I think this isn't easy to implement, especially if you take also
> weak and strong validators into account.
>

To implement support for the if-modified-since header and when running
Apache, you would put something like the following on top of your page:

$request = array_change_key_case(apache_request_headers(), CASE_LOWER);
if (isset($request['if-modified-since'])) {
if (filemtime(__FILE__) > strtotime($request['if-modified-since'])) {
header("HTTP/1.1 304 Not Modified");
exit;
}
}

The key here is the apache_request_headers() function, which is used to
parse the request headers.


JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация