ProcedureReturn EndIf Display the Body of the HTTP resp (This is the HTML that the browser would receive if it had been an interactive form submission from the browser.)Ģ000-2023 Chilkat Software, Inc. If CkHttp:: ckLastMethodSuccess(http) = 0 Resp.i = CkHttp:: ckPostUrlEncoded(http, "",req) The Content-Type used w/ the request will be application/x-www-form-urlencoded PureBasic and Visual Basic belong to 'Languages' category of the tech. Send the HTTP POST by calling PostUrlEncoded. Visual Basic is derived from BASIC and enables the rapid application development (RAD) of graphical user interface (GUI) applications, access to databases using Data Access Objects, Remote Data Objects, or ActiveX Data Objects, and creation of ActiveX controls and objects. Add the form parameters to the HTTP request: CkHttpRequest:: ckAddParam(req, "firstname", "John")ĬkHttpRequest:: ckAddParam(req, "lastname", "Doe")ĬkHttpRequest:: ckAddParam(req, "myHiddenField1", "Hidden Value 1")ĬkHttpRequest:: ckAddParam(req, "myHiddenField2", "Hidden Value 2") See Global Unlock Sample for sample code. This example requires the Chilkat API to have been previously unlocked. The SynchronousRequest would instead be called. The PostUrlEncoded method should not be called for HTTP file uploads. In this case, a browser will send the POST using a content-type of "multipart/form-data". Note: An HTTP file upload is a form submission having an "input" tag w/ "type=file". under the header fields),Ĭontent-Type: application/x-www-form-urlencodedįirstname=John&lastname=Doe&myHiddenField1=Hidden+Value+1&myHiddenField2=Hidden+Value+2 The raw HTTP POST sent to the web server in this example This will be the 1st argument passed to the PostUrlEncoded method. In this case, it is a relative URL, and since there is no directory path, the full URL of the POST target is "". The URL specified in the "action" attribute may be an absolute or relative URL. In the HTML form shown above, it is "echoPost.asp". The target URL is indicated by the "action" attribute on the "form" tag. These are duplicated in code by calling AddParam on the HTTP Request object for each parameter. The HTML to be duplicated is shown below, and may be tested in a browser by going to this URL: īy default, a browser will send a form POST as an HTTP reqeuest using a Content-Type of "application/x-Therefore, one should use the PostUrlEncoded method to duplicate the form submission.Įach "input" or "select" tag found in the HTML is a form parameter having a name and value. This example shows how to duplicate a simple HTML form submission. (PureBasic) Duplicating a Simple HTML Form Submission (POST)
0 Comments
Leave a Reply. |