comp • gb.net.curl • httpclient • post

HttpClient.Post (gb.net.curl)

Sub Post ( ContentType As String, Data As String [ , Headers As String[], TargetFile As String ] )

This method performs a call to the http server using the standard 'POST' method.

Prior to use it you have to fill the URL property with the desired host name and document to retrieve.

  • ContentType is the MIME type of the data.

  • Data is the data to put.

  • Headers is an optional String array of HTTP headers.

  • TargetFile is an optional file where the response will be written.

If TargetFile is not specified, data received from server is stored in memory, and you can access to the document using standard stream methods or the Peek method.

If TargetFile is specified, data received from server will be saved in the specified file, and will be not available in the internal memory buffer.

If you want to submit form data, use application/x-www-form-urlencoded as the ContentType header of the request. After doing this, format the Data parameter with a string following the syntax of Key1=Value1&Key2=Value2&...