# Saturday, November 29, 2008

VFPConnection Library
I first introduced the VFPConnection.fll in an earlier blog post and the functionality it provided at the time was adequate for the task at hand. However, it didn't provide support for some of the features that members of the VFP Community wanted. Most of the enhancement requests I received from them centered around two things:

  • Support for SSL (HTTPS and FTPS)
  • Implementation of a Tracing/Debugging Mechanism

So, I've enhanced the FLL to provide additional functions and another callback parameter that seek to fulfill a portion of these two requests. There is certainly much more that can be done (and will be done) with this FLL in the future. For now I believe the additional features I've implemented warrant the release of an update. At the bottom of this blog entry, you'll find a download link for the updated FLL, some new sample use code, and new documentation that encompasses the additional functions and callback parameter.

What's New
I've added 6 new functions to handle communication via Secure Sockets Layer (SSL): FTPSGet(), FTPSPut(), FTPSToStr(), HTTPSGet(), HTTPSPUT(), HTTPSToStr(). I've also added a new parameter, cTraceCallback, to all of the FLL's functions. This new callback is especially useful when doing FTP/FTPS transfers as it reports on all of the traffic going back and forth between the client and server.

What's Next
I plan to add a bunch more FTP functionality and some facility for doing HTTP POSTs. I'm hopeful that those of you that download this library will take the time to provide me feedback and any suggestions you may have for further improving it. The update provided here is a testament to the fact that your feedback is valuable and an integral part of the improvement process for the stuff I provide to the VFP Community.

Until next time... Visual FoxPro Rocks!


PLEASE NOTE: An updated version of this FLL and documenation is available here.


VFPConnection FLL Download (395 KB approx.)

 

VFPConnection.FLL Sample Use Code:

CLEAR
SET LIBRARY TO (LOCFILE("vfpconnection.fll","FLL"))

*!* Uncomment any of the lines of code below, modify it to suit, and then execute the code.
*!* NOTE: The new trace parameter

*!* ?FILEGet("File:///C:\Source.txt", "C:\Destination.txt", "MyProgress()", "MyTrace()")
*!* ?FTPGet("FTP://UserName:Password@somedomain.com/directory/Source.zip", "C:\Destination.zip", "MyProgress()", "MyTrace()")
*!* ?FTPSGet("FTPS://UserName:Password@somedomain.com:21/directory/Source.zip", "C:\Destination.zip", "MyProgress()", "MyTrace()")
*!* ?HTTPGet("http://www.somedomain.com/Source.htm", "C:\Destination.htm", "MyProgress()", "MyTrace()")
*!* ?HTTPSGet("https://www.somedomain.com/Source.htm", "C:\Destination.htm", "MyProgress()", "MyTrace()")

*!* ?FILEPut("C:\Source.txt", "File:///C:\Destination.txt", "MyProgress()", "MyTrace()")
*!* ?FTPPut("C:\Source.zip", "FTP://UserName:Password@somedomain.com/directory/Destination.zip", "MyProgress()", "MyTrace()")
*!* ?FTPSPut("C:\Source.zip", "FTPS://UserName:Password@somedomain.com:21/directory/Destination.zip", "MyProgress()", "MyTrace()")
*!* ?HTTPPut("C:\Source.htm", "http://www.somedomain.com/Destination.htm", "MyProgress()", "MyTrace()")
*!* ?HTTPSPut("C:\Source.htm", "https://www.somedomain.com/Destination.htm", "MyProgress()", "MyTrace()")

*!* ?FILEToStr("C:\Source.txt")
*!* ?FTPSTOSTR("FTPS://UserName:Password@somedomain.com:21/directory/Source.txt")
*!* ?HTTPSToStr("https://www.somedomain.com/Source.txt")

SET LIBRARY TO

***********************
FUNCTION MyProgress() && Callback from the FLL - can be used to track operation progress
***********************
?m.nConnectTotalBytes
?m.nConnectBytesSoFar
ENDFUNC

***********************
FUNCTION MyTrace() && Callback from the FLL - used to provide a detailed trace of the operation
***********************
    #DEFINE TYPE_TEXT 0
    #DEFINE TYPE_HEADER_IN 1
    #DEFINE TYPE_HEADER_OUT 2
    #DEFINE TYPE_DATA_IN 3
    #DEFINE TYPE_DATA_OUT 4
    #DEFINE TYPE_SSL_DATA_IN 5
    #DEFINE TYPE_SSL_DATA_OUT 6
    #DEFINE TYPE_END 7
?ICASE(m.nTraceDataType = TYPE_TEXT, "STATUS:", ;
     m.nTraceDataType = TYPE_HEADER_IN, "<RECV HEADER: ", ;
     m.nTraceDataType = TYPE_HEADER_OUT, ">SEND HEADER: ", ;
     m.nTraceDataType = TYPE_DATA_IN, "<RECV DATA: ", ;
     m.nTraceDataType = TYPE_DATA_OUT, ">SEND DATA: ", ;
     m.nTraceDataType = TYPE_SSL_DATA_IN, "<RECV SSL DATA: ", ;
     m.nTraceDataType = TYPE_SSL_DATA_OUT, ">SEND SSL DATA: ", ;
     m.nTraceDataType = TYPE_END, "END: ", "UNKNOWN: ")
??m.cTraceData
ENDFUNC



VFPConnection.FLL Documenation:


Function FTPGet()

Signature: FTPGet(cSourceURL, cDestination[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to download.

cDestination - The full path and file name where you want the source file saved.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to download a file from an FTP site.

In order to specify port or login information you would simply include them in cSourceURL, such as “FTP://myusername:mypassword@myftpsite.com:21/mydir/myfile.zip”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function FTPSGet()

Signature: FTPSGet(cSourceURL, cDestination[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to download.

cDestination - The full path and file name where you want the source file saved.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to download a file from an FTP site that provides FTP over Secure Sockets Layer (SSL). It should be noted that this function does not check the site's certificate for authenticity/validness nor does it compare the site to the identity specified by the certificate.

In order to specify port or login information you would simply include them in cSourceURL, such as “FTPS://myusername:mypassword@myftpsite.com:21/mydir/myfile.zip”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function HTTPGet()

Signature: HTTPGet(cSourceURL, cDestination[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to download.

cDestination - The full path and file name where you want the source file saved.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to download a file from a website.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function HTTPSGet()

Signature: HTTPSGet(cSourceURL, cDestination[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to download.

cDestination - The full path and file name where you want the source file saved.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to download a file from a a website that provides HTTP over Secure Sockets Layer (SSL). It should be noted that this function does not check the site's certificate for authenticity/validness nor does it compare the site to the identity specified by the certificate.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function FILEGet()

Signature: FILEGet(cSourceURL, cDestination[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The full path and file name to the file you wish to copy.

cDestination - The full path and file name where you want the source file saved.

cProgressCallback – An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to copy a file from a local or remote location.

The format for the cSourceURL parameter is slightly different than you might expect. In order to copy file C:\MyDir\MyFile.zip you would specify cSourceURL as  “FILE:// C:\MyDir\MyFile.zip”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function FTPPut()

Signature: FTPPut(cSource, cDestinationURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSource - The full path and file name of the file you want uploaded.

cDestinationURL - The URL to where the file specified in cSource should be uploaded to.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to upload a file to an FTP site.

In order to specify port or login information you would simply include them in cDestinationURL, such as “FTP://myusername:mypassword@myftpsite.com:21/mydir/myfile.zip”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function FTPSPut()

Signature: FTPSPut(cSource, cDestinationURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSource - The full path and file name of the file you want uploaded.

cDestinationURL - The URL to where the file specified in cSource should be uploaded to.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to upload a file to an FTP site that provides FTP over Secure Sockets Layer (SSL). It should be noted that this function does not check the site's certificate for authenticity/validness nor does it compare the site to the identity specified by the certificate.

In order to specify port or login information you would simply include them in cDestinationURL, such as “FTPS://myusername:mypassword@myftpsite.com:21/mydir/myfile.zip”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function HTTPPut()

Signature: HTTPPut(cSource, cDestinationURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSource - The full path and file name of the file you want uploaded.

cDestinationURL - The URL to where the file specified in cSource should be uploaded to.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to upload a file to a website.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function HTTPSPut()

Signature: HTTPSPut(cSource, cDestinationURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSource - The full path and file name of the file you want uploaded.

cDestinationURL - The URL to where the file specified in cSource should be uploaded to.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to upload a file to a website that provides HTTP over Secure Sockets Layer (SSL). It should be noted that this function does not check the site's certificate for authenticity/validness nor does it compare the site to the identity specified by the certificate.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function FILEPut()

Signature: FILEPut(cSource, cDestinationURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSource - The full path and file name of the file you want copied.

cDestinationURL - The full path and file name where the file specified in cSource should be copied to.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to copy a file to a local or remote location.

The format for the cDestinationURL parameter is slightly different than you might expect. In order to copy file C:\MyDir\MyFile.zip you would specify cDestinationURL as  “FILE:// C:\MyDir\MyFile.zip”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function FTPToStr()

Signature: FTPToStr(cSourceURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to return a string from.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Character Data - the contents of the file specified by cSourceURL

Remarks:

This function provides the ability to retrieve a file from an FTP site as a string.

In order to specify port or login information you would simply include them in cSourceURL, such as “FTP://myusername:mypassword@myftpsite.com:21/mydir/myfile.txt”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function FTPSToStr()

Signature: FTPSToStr(cSourceURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to return a string from.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Character Data - the contents of the file specified by cSourceURL

Remarks:

This function provides the ability to retrieve a file as a string from an FTP site that provides FTP over Secure Sockets Layer (SSL). It should be noted that this function does not check the site's certificate for authenticity/validness nor does it compare the site to the identity specified by the certificate.

In order to specify port or login information you would simply include them in cSourceURL, such as “FTPS://myusername:mypassword@myftpsite.com:21/mydir/myfile.txt”.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function HTTPToStr()

Signature: HTTPToStr(cSourceURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to download.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to retrieve a file from a website as a string.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

 



Function HTTPSToStr()

Signature: HTTPSToStr(cSourceURL[, cProgressCallback[, cTraceCallback]])

Parameters:

cSourceURL - The URL to the file you wish to download.

cProgressCallback - An optional string denoting a function, procedure, or method that you want fired whenever a read/write occurs, such as "MyProgress()".

cTraceCallback - An optional string denoting a function, procedure, or method that you want fired whenever additional information regarding the status of the operation is available. Eample: "MyTrace()"

Return Value:

Logical - returns .T. if successful or .F. if the operation has failed.

Remarks:

This function provides the ability to retrieve a file as a string from a website that provides HTTP over Secure Sockets Layer (SSL). It should be noted that this function does not check the site's certificate for authenticity/validness nor does it compare the site to the identity specified by the certificate.

When the cProgressCallback is called 2 variables (nConnectTotalBytes and nConnectBytesSoFar) are created dynamically by the FLL. These variables can be used within the specified function, procedure, or method to determine the total size of the source file in bytes as well as the total progress of the operation (Percentage = 100 * nConnectBytesSoFar / nConnectTotalBytes).

When the cTraCallback is called 2 variables (nTraceDataType and cTraceData) are created dynamically by the FLL. The variable nTraceDataType specifies the type of operation that produced the information contained in cTraceData. The possible values for nTraceDataType are as follows: 0 = Text, 1 = Header In, 2 = Header Out, 3 = Data In, 4 = Data Out, 5 = SSL Data In, 6 = SSL Data Out, 7 = End.

Saturday, November 29, 2008 1:01:34 PM (GMT Standard Time, UTC+00:00)  #    Comments [2]

 

Archive

<September 2014>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011