ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileDateTime for Internet web page (https://www.excelbanter.com/excel-programming/330399-filedatetime-internet-web-page.html)

Mogwai

FileDateTime for Internet web page
 
Hi,

Can you get the Created/LastModified Date for an Internet web page?

Thanks


michelxld[_2_]

FileDateTime for Internet web page
 

Hello

I hope this help you


Sub Informations_And_metaDatas_WebPage()
'michelxld le 11.05.2005
'activate Microsoft HTML Objects Library
'activate Microsoft Internet Controls
Dim IE As New InternetExplorer
Dim htmlDoc As HTMLDocument
Dim htmlRef As IHTMLMetaElement
Dim i As Byte

IE.Navigate "http://www.exceltip.com/"
Do Until IE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

Set htmlDoc = IE.Document
'informations
MsgBox htmlDoc.Title & vbLf & htmlDoc.fileCreatedDate & _
vbLf & htmlDoc.LastModified & vbLf & htmlDoc.fileSize & " octets ."

'metadatas in web Page ( description & keywords )
For i = 0 To 1
Set htmlRef = htmlDoc.all.tags("meta").Item(i)
MsgBox htmlRef.content
Next i

Set IE = Nothing
End Sub


Regards ,
miche

--
michelxl
-----------------------------------------------------------------------
michelxld's Profile: http://www.excelforum.com/member.php...fo&userid=1736
View this thread: http://www.excelforum.com/showthread.php?threadid=37484


Mogwai

FileDateTime for Internet web page
 
Hi Michael,

Thanks for the reply.

I was hoping for a means to check a webpage (or file from a web server)
creation/modified date, without having to open/brows the file.

Can your macro be altered to achieve this, or would you say such a
thing was undoable?

Thanks


Jake Marx[_3_]

FileDateTime for Internet web page
 
Hi Mogwai,

Mogwai wrote:
I was hoping for a means to check a webpage (or file from a web
server) creation/modified date, without having to open/brows the file.

Can your macro be altered to achieve this, or would you say such a
thing was undoable?


If you're talking about a web server to which you have direct access, then
you could probably do this with the FileSystemObject. Otherwise, for a
remote web page, you would have to make an HTTP request on the URL and
retrieve the header information in a way like michel demonstrated.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Mogwai

FileDateTime for Internet web page
 
Hi Jake,

Thanks for this.

I would be talking about a remote web page, so don't have direct access
as such.

I am trying to get the Date/Time a page was up-loaded to a web server,
as I believe this to be the most accurate Date/Time (assuming the
Server clock is correct).

I know there is Javascript, that can alert the Date/Time for a page and
the Properties of a page can also show Date/Time details, but these
don't always match or appear accurate!?!

Is there no definitive means to finding out when a remote web page
(Internet/Intranet) was created/up-loaded other than the authors word?

Heres a random example:

On following WebPage [ http://www.toggle.org/html/0409art6.htm ] the
author has indicated that the information was published "Number 256 -
September 2004", however the Page properties say the page was Created
and Modified on "06/02/2005". If you follow the instruction within the
page and enter the Javascript into the address bar, you get the
following "01/01/1970 01:00:00" ...they can't all be right?

Thanks


Jake Marx[_3_]

FileDateTime for Internet web page
 
Hi Mogwai,

Unfortunately, if you have no control over the web server, there's not much
you can do. The web server is returning the "Last-Modified" header as part
of its HTTP response. So if it's not telling the truth (or if there is some
technical reason that the file is modified often or recreated often), you'll
get useless information back.

Here's a way to request just the HTTP headers - should be pretty fast:

Public Function gsGetLastModifiedDate(rsURL As String) As String
Dim x As Object

On Error GoTo ErrHandler

Set x = CreateObject("MSXML2.XMLHTTP.5.0")

x.Open "HEAD", rsURL, False
x.send
gsGetLastModifiedDate = x.getResponseHeader("Last-Modified")

ExitRoutine:
Set x = Nothing
Exit Function
ErrHandler:
Resume ExitRoutine
End Function

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Mogwai wrote:
Hi Jake,

Thanks for this.

I would be talking about a remote web page, so don't have direct
access as such.

I am trying to get the Date/Time a page was up-loaded to a web server,
as I believe this to be the most accurate Date/Time (assuming the
Server clock is correct).

I know there is Javascript, that can alert the Date/Time for a page
and the Properties of a page can also show Date/Time details, but
these don't always match or appear accurate!?!

Is there no definitive means to finding out when a remote web page
(Internet/Intranet) was created/up-loaded other than the authors word?

Heres a random example:

On following WebPage [ http://www.toggle.org/html/0409art6.htm ] the
author has indicated that the information was published "Number 256 -
September 2004", however the Page properties say the page was Created
and Modified on "06/02/2005". If you follow the instruction within the
page and enter the Javascript into the address bar, you get the
following "01/01/1970 01:00:00" ...they can't all be right?

Thanks




All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com