; *****************************************************
; Example52.ftp
; =============
; This example shows the use of HTTP statements.
; HTTP statements allow you to:
; - HTTPGET: Download files using HTTP protocol.
; - HTTPGETDATE: Get and determine the dates of the HTTP files (Not all servers support this).
; - HTTPGETHEADER: Download the header information.
; - HTTPPARSELINKS: Parse the links of a HTML document.
; - HTTPPARSEFILES: Parse the files referred to by a HTML document.
;
;
; Available variables for the HTTP concept:
; Use only if at all needed, otherwise, do not set these values:
; HttpPort
; HttpPassword
; HttpUsername
;
; HttpProxy
; HttpProxyPort
; HttpProxyUser
; HttpProxyPassword
;
; The value of this variable is set by the HTTPGETDATE statement:
; HttpDate
; HttpTime
;
; The value of these variables are set by the HTTPPARSELINKS statement:
; HttpNumLinks
; HttpLink_x
;
; The value of these variables are set by the HTTPPARSEFILES statement:
; HttpNumFiles
; HttpFile_x
;
;
; -----------------------------------------------------
; NOTE: You are able to execute the script unchanged
; Except if you are needing a firewall to access
; the Internet.
; ****************************************************
numvariable i
Let SHomePage="http://www.transsoft.com"
; Get TransSoft's Homepage document
httpGet "%%SHomePage%%"
message "The homepage was saved in the file://13////13//%%LastHTTPFilename%%"
; Retrieve it's "Last modified" date and display it:
HttpGetDate "%%SHomePage%%"
Message "The modification date/time stamp of %%SHomePage%% is://13////13//Date: %%httpdate%%//13//Time is: %%httptime%%"
; Retrieve the "Header information" of the Homepage and open it in editor:
HttpGetHeader "%%SHomePage%%"
EditFile A "%%LastHTTPHeaderFilename%%"
; Parse the URL links and save the resulting list in
; a text file called "HTTPLinks.txt"
HttpParseUrls "%%LastHTTPFilename%%"
if %%HttpNumLinks%% > 0 then
; Write it to the diskfile:
OutputOpen 1 "C:\HTTPLinks.txt"
for i = 1 to %%HttpNumLinks%%
OutputWrite 1 "%%HttpLink_[%%i%%]%%"
next i
OutputClose 1
; Open the file in editor to show the content:
EditFile A "C:\HTTPLinks.txt"
else
message "There are no ''HREF'' links found in the file!"
endif
; Parse the URL File references and save the resulting list in
; a text file called "HTTPFiles.txt"
HttpParseFiles "%%LastHTTPFilename%%"
if %%HttpNumFiles%% > 0 then
; Write it to the diskfile:
OutputOpen 1 "C:\HTTPFiles.txt"
for i = 1 to %%HttpNumFiles%%
OutputWrite 1 "%%HttpFile_[%%i%%]%%"
next i
OutputClose 1
; Open the file in editor to show the content:
EditFile A "C:\HTTPFiles.txt"
else
message "There are no ''SRC'' file references found in the file!"
endif