[Gambas-user] Class HTTPForm

T Lee Davidson t.lee.davidson at gmail.com
Mon Apr 11 16:20:50 CEST 2022


On 4/11/22 04:30, Hans Lehmann wrote:
> Hello.
> 
> In the Gambas documentation I can't find a hint for which *purpose* one uses the class HTTPForm. I don't have a look at the 
> source code of a small project that shows how to use this class. Therefore I ask if someone can help with an example.
> 
> With kind regards
> 
> Hans

It's purpose is stated in the first paragraph, "This class allows to forge an HTTP request equivalent to an HTML form post." 
Perhaps it needs to be worded differently to make it more clear?

It is simply an easier manner in which to craft and submit a HTML form than using HttpClient. As you can see, it inherits 
HttpClient and introduces four new methods: Add, AddFile, Remove, and Submit.

I don't have time at the moment to create and test an example. But, it should be relatively simple following the HttpClient 
examples. Just add your form data using the .Add() method [ie. HttpForm.Add("myField1", "myValue1")] as many times as needed, 
and then submit the form with HttpForm.Submit().


-- 
Lee


More information about the User mailing list