ph_itcexecutehttp PowerHome formula function
Description
Executes an HTTP request in the specified Internet Transfer Control.
Syntax
ph_itcexecutehttp ( n, s, s, s, s, n )
Argument |
Description |
n
|
A number from 1 to 10 representing the ITC you wish to execute an HTTP request.
|
s
|
A string representing the HTTP operation. See Usage below.
|
s
|
A string that specifies the DATA to be used for operations (POST and PUT). Use empty string ("") for GET and HEAD operations.
|
s
|
A string representing additional HEADERS to be returned from the server. For most operations, use the empty string ("").
|
s
|
The ID of a macro to be executed when the operation completes.
|
n
|
The request timout in seconds. Use 0 for infinity.
|
Return value
Integer. Returns a 0 if successful. If the specified ITC has not been created, then 1 is returned. 2 is returned if the specified ITC is outside of the range of 1 to 10. 3 is returned if the ITC is currently busy. 4 is returned if a runtime error occurs.
Usage
This function call is asynchronous. When an HTTP request is made, this function returns immediately and the request is processed in the background. When the operation is complete, the specified Macro will then be executed. When the macro is executed, it will have a complete copy of LOCAL and TEMP variables that were assigned when the function was executed. However, the [TEMP1] variable will contain the response code. A value of 10 means that the control has disconnected. A value of 11 means that an error occurred. A value of 12 means that the request completed successfully. If an error occurs (response code 11 in [TEMP1]), then the error code will be in the [TEMP2] variable and the error info will be in the [TEMP3] variable.
The HTTP operation is contained within a single string. Below is a list of valid parameters:
Operation |
Description |
GET |
Retrieve data from the URL specified. |
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. |