On Wednesday 13 August 2003 20:13, Moriyoshi Koizumi wrote:

> 304 Not Modified
>
> "r--"

Since we're looking at "simple http access" I don't think this should return 
readable. Normally you would not be able to set headers when using 
fopen('http://') (right?), so technically, you would not be able to get a 304 
response, because that would only be returned, on requests that have a 
'If-Not-Modified-Since' and family request header.

IF you DO get a 304 response for whatever reason, then you still have no 
content at all because the content is assumed to be in the 'local browser 
cache'.

The other route to take, would be to indeed have local cache, but I'm not sure 
if this is at all usefull. It would look something like this:
<?php
// || is just an example - but illustrates part of the problem.
$fp 
=fopen('http://www.example.com/newsfeed.rss||/usr/local/www/data/examplefeed.rss", 
'r');
?>

This would then send If-Not-Modified-Since, whith the gmtime of the filemtime 
of examplefeed.rss stored locally. If you get a 304, than examplefeed.rss is 
returned, otherwise the remote file is returned and examplefeed.rss modified 
accordingly.

I suppose it would be useful, in environments where users are not able to use 
crontabs and you wanna limit the number of times the file is downloaded, but 
with a little playing around with fsockopen, you can do the exact same thing.

-- 
Melvyn

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to