Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LAST DATE OF MODIFIED FILE on WEB 1

Status
Not open for further replies.
Sure. here's an example that gives you booth the size and the [tt]last-modified[/tt] date. but be warned, not all servers provide the last-modified response header (in which case we could play with the [tt]If-Modified-Since[/tt] request header instead)

Code:
[COLOR=blue]Public Sub Example()
    Dim objHttp As Object, strURL As String
    
    strURL = "[URL unfurl="true"]https://www.tek-tips.com/images/header-logo.png"[/URL]
    Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
    
    objHttp.Open "HEAD", strURL, False [COLOR=green]' just return the Headers, avoids downloading the file[/color]
    objHttp.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
    objHttp.send
    MsgBox "File size of " & strURL & " is " & objHttp.getResponseHeader("content-length") & " bytes" & vbCrLf & "Last modified: " & objHttp.getResponseHeader("last-modified")

End Sub[/color]
 
ops...
but this property have a date created, similar:

objHttp.getResponseHeader ("???????")
 
Date created? That's not a property you can retrieve over HTTP. List of legitimate Request headers can be found here. You'll not find anything related to a creation date. HTTP is not a file system.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top