Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file date on webserver
#2
If you can connect through ftp, use http://Ftp.Dir:

Code:
Copy      Help
Ftp f.Connect("www.aaa.com")
f.DirSet("public_html")
WIN32_FIND_DATA fd
if(f.Dir("file.htm" 0 &fd))
,DATE d.fromfiletime(fd.ftLastWriteTime)
,out d
,;or
,SYSTEMTIME st
,FileTimeToSystemTime &fd.ftLastWriteTime &st
,;...

Http protocol also allows to query file date, but not for all files.

Create new member function Http.QueryInfo:

Code:
Copy      Help
function# $file what str&info

;Retrieves specified header for file.
;what is one of inet.HTTP_QUERY_x flags. Use HTTP_QUERY_RAW_HEADERS_CRLF to retrieve all headers.

;EXAMPLES
;Http h.Connect("www.google.com")
;str s
;if(h.QueryInfo("about.html" HTTP_QUERY_RAW_HEADERS_CRLF s))
,;out s
;
;if(h.QueryInfo("about.html" HTTP_QUERY_LAST_MODIFIED s))
,;out s
;
;if(h.QueryInfo("about.html" HTTP_QUERY_LAST_MODIFIED|HTTP_QUERY_FLAG_SYSTEMTIME s))
,;SYSTEMTIME& st=+s
,;DATE d.fromsystemtime(st)
,;out d


def ERROR_INSUFFICIENT_BUFFER  122

int hr=HttpOpenRequest(m_hi 0 file 0 0 0 INTERNET_FLAG_RELOAD 0); if(!hr) goto e
if(!HttpSendRequest(hr 0 0 0 0)) goto e
_i=1000
if(!HttpQueryInfo(hr what info.all(_i) &_i 0))
,if(GetLastError!=ERROR_INSUFFICIENT_BUFFER) goto e
,if(!HttpQueryInfo(hr what info.all(_i) &_i 0)) goto e
info.fix(_i)
InternetCloseHandle hr
ret 1
;e
if(hr) InternetCloseHandle hr
Error


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)