> 
> I'm trying to use libxml_set_streams_context() to load a 
> remote xml file via HTTP conditional GET with 
> DOMDocument::load() by stuffing an
> 'If-Modified-Since: --- " HTTP header into the stream, but no 
> matter how I try it I always get an HTTP 200 response when I 
> know the last- modified date is well before my if-modified 
> date string.
> 
> I've confirmed via curl -H on the command line that I can do 
> it properly and get an HTTP 304 as expected, but I don't know 
> what I'm not doing right with libxml_set_streams_context(). 
> Here's my code:
> 
> $opts = array('http'=>array('method'=>"GET", 'header'=>"If-Modified-
> Since: Wed, 18 May 2005 23:55:29 GMT\r\n")); $context = 
> stream_context_create($opts); libxml_set_streams_context($context);
> $doc->load('http://www.somewhere.com/somefile.xml');
> echo $doc->saveXML();
> 
> using the same $context resource, this also produces the same 
> result, when I expect it should work.
> 
> file_get_contents('http://www.somewhere.com/somefile.xml', 
> false, $context);
> 
> I have php 5.0.4 compiled with libxml2 (2.6.16) on Mac OS X 
> 10.4. I imagine I'm not doing something correctly, but can't 
> figure out what it is.
> 
> Any help?

Sure the server is checking if modified since headers?

Just tried a bit of code here and it seems to be working as expected (5.0.4 
Win32)

$opts = array('http'=>array('method'=>"GET", 'header'=>"If-Modified-Since: Wed, 
18 May 2005 23:55:29 GMT\r\n"));
$context = stream_context_create($opts); libxml_set_streams_context($context);
 file_get_contents('http://localhost/headersave.php', FALSE, $content); 

headersave.php

file_put_contents('headers.txt', var_export($_SERVER, TRUE));
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])
{
        header('HTTP/1.0 304 Not Modified');
            exit;
}


Jared

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to