Executes a request to a remote server. You can only send requests which are valid for the particular protocol.
Syntax
object.Execute url, operation, data, requestHeaders
The Execute property syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
url | Optional. String that specifies the URL to which the control should connect. If no URL is specified here, the URL specified in the URL property will be used. |
operation | Optional. String that specifies the type of operation to be executed. See Settings below for a list of supported operations. |
data | Optional. String that specifies the data for operations (See Settings below.) |
requestHeaders | Optional. String that specifies additional headers to be sent from the remote server. The format for these is:header name: header value vbCrLf |
Settings
Note Valid settings for operation are determined by the protocol being used. The tables below are organized by protocol.
Supported HTTP commands
Valid settings for operation are:
Operation | Description |
GET | Retrieve data from the URL specified in the URL property. |
HEAD | Sends the Request headers. |
POST | Posts data to the server. The data is located in the data argument. This is an alternate method to GET, for which additional instructions are specified in the data argument. |
PUT | Put operation. The name of the page to be replaced is located in the data argument. |
Supported FTP commands
Important The FTP protocol uses a single string that includes the operation name and any other parameters needed by the operation. In other words, the data and requestHeaders arguments are not used; all of the operations and their parameters are passed as a single string in the operation argument. Parameters are separated by a space. In the descriptions below, do not confuse the terms "file1" and "file2" with the data and requestHeaders arguments.
The syntax for FTP operations is:
operationName file1 file2.
For example, to get a file, the following code invokes the Execute method, which includes the operation name ("GET"), and the two file names required by the operation:
Inet1.Execute "FTP://ftp.microsoft.com", _
"GET Disclaimer.txt C:\Temp\Disclaimer.txt"
Note File names that include embedded spaces are not supported.
Valid FTP settings for operation are:
Operation | Description |
CD file1 | Change Directory. Changes to the directory specified in file1. |
CDUP | Change to parent directory. Equivalent to "CD.." |
CLOSE | Closes the current FTP connection. |
DELETE file1 | Deletes the file specified in file1. |
DIR file1 | Directory. Searches the directory specified in file1. (Wildcards are permitted but the remote host dictates the syntax.) If no file1 is specified, a full directory of the current working directory is returned. Use the GetChunk method to return the directory data. |
GET file1 file2 | Retrieves the remote file specified in file1, and creates a new local file specified in file2. |
LS file1 | List. Searches the directory specified in file1. (Wildcards are permitted but the remote host dictates the syntax.) Use the GetChunk method to return the file directory data. |
MKDIR file1 | Make Directory. Creates a directory as specified in file1. Success is dependent on user privileges on the remote host. |
PUT file1 file2 | Copies a local file specified in file1 to the remote host specified in file2. |
PWD | Print Working Directory. Returns the current directory name. Use the GetChunk method to return the data. |
QUIT | Terminates the current user. |
RECV file1 file2 | Retrieves the remote file specified in file1, and creates a new local file specified in file2. Equivalent to GET. |
RENAME file1 file2 | Renames the remote file named in file1 to the new name specified in file2. Success is dependent on user privileges on the remote host. |
RMDIR file1 | Remove Directory. Removes the remote directory specified in file1. Success is dependent on user privileges on the remote host. |
SEND file1 file2 | Copies a local file, specified in file1, to the remote host, specified in file2. Equivalent to PUT. |
SIZE file1 | Returns the size of the directory specified in file1. |
Return Type
None
Remarks
Many commands listed above can be carried out only if the user has privileges on the host server. For example, anonymous FTP sites will not allow anyone to delete files or directories.