You can add a custom header to the simplexml_load_file file.

I want to load a deleted page only when it is different from the version that I already have. There is no "Last-Modified" or "Expires" (the server sends Cache-Control: max-age=0, private, must-revalidate), but there is a field ETag:.

So, I can send a header If-None-Match:with the last ETag value and, with any error (including 304 Not Modified), try again after a delay.

I am currently using a simplexml_load_fileURL grabber, and I wonder if I can just name it somehow by adding an extra header, or do I need to deploy heavier solutions (curl, file_get_contents, etc.)?

+3
source share
1 answer

cURL , simplexml_load_string ( cURL), SimpleXMLElement .

curl_setopt($ch, CURLOPT_HTTPHEADER, array('If-None-Match:: XXX'));
+2

All Articles