Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IntGetFileSize
#4
Function IntGetLastModified
Code:
Copy      Help
;/
function'DateTime $url [inetflags]  ;;flags: convert UTC/GMT to local time

;Returns internet file Last-Modified date.

;url - file URL.
;inetflags - optional dwFlags argument for InternetOpenUrl API.

;REMARKS
;Sends request to download the file, but gets only response headers, not whole file.
;Error if fails, or if there is no Last-Modified header.
;The date is in GMT time zone, which is the same as UTC. Use UtcToLocal if need your local time, see example.

;EXAMPLE
;DateTime t=IntGetLastModified("http://www.quickmacros.com/support.html")
;t.UtcToLocal
;out t.ToStr


#opt nowarnings 1
Http http
__HInternet hi=InternetOpenUrl(http.hinternet(1) url 0 0 inetflags 0); if(!hi) end "failed"
SYSTEMTIME st; _i=sizeof(st)
if(!HttpQueryInfo(hi HTTP_QUERY_LAST_MODIFIED|HTTP_QUERY_FLAG_SYSTEMTIME &st &_i 0)) end "unknown Last-Modified"
DateTime r.FromSYSTEMTIME(st)
ret r
Function IntGetLastModifiedString
Code:
Copy      Help
;/
function'str $url [inetflags]

;Returns internet file Last-Modified date as raw header string.

;url - file URL.
;inetflags - optional dwFlags argument for InternetOpenUrl API.

;REMARKS
;Sends request to download the file, but gets only response headers, not whole file.
;Error if fails, or if there is no Last-Modified header.


#opt nowarnings 1
Http http
__HInternet hi=InternetOpenUrl(http.hinternet(1) url 0 0 inetflags 0); if(!hi) end "failed"
_s.all(300); _i=300
if(!HttpQueryInfo(hi HTTP_QUERY_LAST_MODIFIED _s &_i 0)) end "unknown Last-Modified"
ret _s.fix


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)