how to check online image date

D

DaveF

I am using the following code to see if the image is there, is there a way
to check the image date as well?

Dim sTxt As String
If strURL <> "" Then
If Left(LCase(strURL), 7) <> "http://" Then
strURL = "http://" & strURL
End If
On Error Resume Next
Dim objHTTP
Dim sHTML
objHTTP = CreateObject("Microsoft.XMLHTTP")

objHTTP.open("GET", strURL, False)
objHTTP.send()
sHTML = objHTTP.statusText
If sHTML <> "OK" Then
sTxt = "fail"
Else
sTxt = "ok"
End If
objHTTP = Nothing
Else
sTxt = "fail"
End If

Dim httpRequest As HttpRequest = HttpContext.Current.Request
Dim strFrom = httpRequest.ServerVariables
Dim p As Integer
p = InStr(1, strFrom, "?")
If p > 0 Then
strFrom = Left(strFrom, p - 1)
End If
If sTxt = "fail" Then
errLog = errLog + "ID=" & ID & "********URL=" & strURL & Chr(13)
& Chr(10)
setActive1(ID, "N")
Else
setActive(ID, "Y")
End If


--


David Fetrow
Helixpoint LLC.
http://www.helixpoint.com
(e-mail address removed)
 
B

bruce barker

a GET actually retrieves the image (look at the headers for date info). use
a HEAD request to just get date and size info.

-- bruce (sqlwork.com)
 
G

Guest

If you want to check if a file you're downloading has changed, you could make
use of the If-Modified-Since header, as described in HTTP.

The Web Server should recognize that header, and only send the file back if
it was modified after your specified date.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top