User Tools

Site Tools


httpwebrequest.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== HTTPWEBREQUEST(send web request) ====== Previous pageReturn to chapter overviewNext page

HTTPWEBREQUEST( httpWebAddress ,httpVerbMethod, postData, requestParameters,[contentType], [headers], responseOut)

blk2blue.jpg

HttpWebRequest Sends a request via HTTP or HTTPS and receives the response into a string buffer
httpWebAddress theURI web address to send the webRequest
httpVerbMethod the verb method used in the webRequest, it can be HttpVerb:GET, POST, PUT, DELETE
postData data passed to the webRequest when using the POST verb
requestParameters parameters passed to the the webRequest appended to the http address after the ? appended to end of the URI
contentType (optional) the request content type, default is “text/xml”
headers (optional) a string containing the headers and values separated by pipes name1valuename2value2
responseOut the buffer to be filled with the response, the buffer needs to be big enough to contain the response value

The HttpWebRequest procedure executes a WebRequest with the passed parameters and stores the response in the responseOut buffer.

Return Data Type: STRING

Returns zero if the request was successful, if the responseOut buffer is not big enough the return value will be the numeric value of the required buffer size. If the value is negative an exception occurred, and the description of the exception is in the responseOut

Requirements:

Create an instance of the ClaRunExtClass to call its methods.

Distribute ClaRunExt.dll (requires that .Net 3.5 or higher is installed on target machines)

Examples:

WebRequest project (WebRequest.sln)

Located in Examples\ClaTalk\HttpRequest

This example shows the use of all variants of HttpWebRequest and HttpWebRequestToFile.  It allows you to interactively experiment with all four HTTP methods; POST, GET, PUT, and DELETE. You specify the server URI, parameters and the HTTP method, and the result (response from the server) is displayed in a Text control, or written to a File.

flickrClient project (flickrClient.sln)

Located in Examples\ClaTalk\flickr

This example uses the flickr HTTP API to make an HTTPWebRequest for a “feed” of public images. It then parses the requested XML response into a Queue, and displays the Image associated with the current selection in the LIST control.

See Also:

HttpWebRequestToFile

httpwebrequest.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1