User Tools

Site Tools


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

HTTPWEBREQUESTtoFile( httpWebAddress ,httpVerbMethod, postData, requestParameters,[contentType], [headers] errorOut, outputFilename)

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
errorOut the text of the error if an error occurred
outputFilename the name of the physical file where the response is saved

The HttpWebRequestToFile procedure executes a WebRequest with the passed parameters and stores the response in the outputFile

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:

HttpWebRequest

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