HTTPRequest component

HTTP request component is implementing the HTTP protocol.

Creating a HTTP request:

From scripting you can create a variable of the type HTTPRequest by the following code:
var req = new THTTPRequest();


req = new THTTPRequest(); req.URL.URL = ""; req.Method = "GET"; req.Send(); if(req.ResponseCanBeProcessed){ Trace(req.ResponseHeaders); }

The above code will retrieve the first page of testphp site. If no errors were encountered, it will log the response headers received.



function AddRequestHeader(Name, Value)

Adds a request header.

Parameter list:

function Send()

Sends the prepared request.

function Reset()

Resets all the values from the request.

property URL

Read and write property of the type URL which holds the URL to which the request should be made.

property Method

The HTTP verb as string which should be sent to the server.

property ResponseBody

String value containing the response body after Send returned.

property Status

Integer HTTP status from the response. It is only valid after Send returned.

property ResponseHeaders

String value containing the response headers after Send returned.

property RequestData

String property which holds the data should be sent with the request. It is useful for POST requests.

property User

String property with the HTTP username. Authentication method is automatically resolved by the component.

property Pass

String property with the HTTP password.

property ResponseCanBeProcessed

Read only boolean property which after a call to Send will return true if no errors has been encoutered while sending the request and receiving the response.

property RequestError

Read only string property which is set to the error encountered when ResponseCanBeProcessed property is false.