1CURLOPT_FILETIME(3)        curl_easy_setopt options        CURLOPT_FILETIME(3)
2
3
4

NAME

6       CURLOPT_FILETIME - get the modification time of the remote resource
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL  *handle,  CURLOPT_FILETIME,  long get‐
12       time);
13

DESCRIPTION

15       Pass a long. If it is 1, libcurl will attempt to get  the  modification
16       time  of  the remote document in this operation. This requires that the
17       remote server sends the time or replies to a time querying command. The
18       curl_easy_getinfo(3)  function  with  the CURLINFO_FILETIME(3) argument
19       can be used after a transfer to extract the received time (if any).
20

DEFAULT

22       0
23

PROTOCOLS

25       HTTP, FTP, SFTP, FILE
26

EXAMPLE

28       curl = curl_easy_init();
29       if(curl) {
30         curl_easy_setopt(curl, CURLOPT_URL, url);
31         /* Ask for filetime */
32         curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
33         res = curl_easy_perform(curl);
34         if(CURLE_OK == res) {
35           res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime);
36           if((CURLE_OK == res) && (filetime >= 0)) {
37             time_t file_time = (time_t)filetime;
38             printf("filetime %s: %s", filename, ctime(&file_time));
39           }
40         }
41         /* always cleanup */
42         curl_easy_cleanup(curl);
43       }
44

AVAILABILITY

46       Always, for SFTP since 7.49.0
47

RETURN VALUE

49       Returns CURLE_OK
50

SEE ALSO

52       curl_easy_getinfo(3),
53
54
55
56libcurl 7.69.1                  April 03, 2017             CURLOPT_FILETIME(3)
Impressum