The “If-Modified-Since” header is used in an HTTP request to ask the server to return the requested resource only if it has been modified since the specified date and time. This allows the client to avoid downloading a resource that hasn’t changed.
You can use the curl
command with the -z
or --time-cond
option to specify the “If-Modified-Since” header in your request. The argument to this option should be a date in the format “YYYYMMDDHHMMSS”.
Here is an example:
curl -z 20170831235959 -o output_file.html http://www.example.com/index.html
In this example, curl
will only download http://www.example.com/index.html
if it has been modified since August 31st, 2017 at 23:59:59. If the resource hasn’t changed, curl
will not download it and will return a “304 Not Modified” HTTP status code instead.
The -o
option is used to specify the output file for the resource. If the resource has been modified and is being downloaded, it will be saved to output_file.html
.