Handling If-modified-since header in a PHP-script

This is definitely possible in PHP! When the browser checks if there were modifications, it sends an If-Modified-Since header; in PHP this value would be set inside $_SERVER[‘HTTP_IF_MODIFIED_SINCE’]. To decode the date/time value (encoded using rfc822 I believe), you can just use strtotime(), so: if (isset($_SERVER[‘HTTP_IF_MODIFIED_SINCE’]) && strtotime($_SERVER[‘HTTP_IF_MODIFIED_SINCE’]) >= filemtime($localFileName)) { header(‘HTTP/1.0 304 Not Modified’); … Read more

Why am I getting “(304) Not Modified” error on some links when using HttpWebRequest?

First, this is not an error. The 3xx denotes a redirection. The real errors are 4xx (client error) and 5xx (server error). If a client gets a 304 Not Modified, then it’s the client’s responsibility to display the resouce in question from its own cache. In general, the proxy shouldn’t worry about this. It’s just … Read more