FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour retrieve file date and time for a Internet file
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
retrieve file date and time for a Internet file
Posted: Thu Jan 23, 2020 11:32 AM

Hi,

Is it possible to obtain the date and time from a file in http://www.google.com/files/update.exe?

Thank you.

Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
Posts: 838
Joined: Wed Aug 22, 2007 10:09 AM
Re: retrieve file date and time for a Internet file
Posted: Thu Jan 23, 2020 11:39 AM
Something like this:

Code (fw): Select all Collapse
 Public Function GetRemoteFilenameTimestamp(ByVal address As Uri) As Date

            Dim request As System.Net.HttpWebRequest
            Dim response As System.Net.HttpWebResponse = Nothing
            Dim dat As Date

            Try
                ' Create the web request   
                request = DirectCast(System.Net.WebRequest.Create(address), System.Net.HttpWebRequest)

                ' Get response   
                response = DirectCast(request.GetResponse(), System.Net.HttpWebResponse)
                dat = response.Headers.Item("Last-Modified")

                'response.Headers.Item("Content-Length")

            Finally
                If Not response Is Nothing Then response.Close()
            End Try

            Return dat

        End Function
Saludos / Regards,



FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40

Continue the discussion