libxml_set_streams_context

From: Date: Wed, 18 May 2005 04:03:45 +0000
Subject: libxml_set_streams_context
Groups: php.general 
Request: Send a blank email to php-general+get-215435@lists.php.net to get a copy of this message
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? -- Bill Hoffman xbhoff@mac.com

« previous php.general (#215435) next »