![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) HTTP POST with some Params in URL and others in application/x-www-form-urlencoded BodyDemonstrates show to send an HTTP POST with some params in the URL, and others in the application/x-www-form-urlencoded Body
integer li_rc string ls_Url oleobject loo_Http oleobject loo_Req oleobject loo_Resp // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // Imagine a URL that contains two params: one named "xyz" and one named "name". // We want to send a POST to it, but with 2 additional params in the body of the request. // The PostUrlEncoded method cannot be used because it parses the URL and puts all the params // in the HTTP body. The SynchronousRequest method should instead be used so // that the req.Path can be explicitly specified. ls_Url = "http://www.chilkatsoft.com/echoPost.asp?xyz=123&name=matt" loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // Provide a session log path so we can visually verify the exact request sent. // (This is only for debugging purposes.) loo_Http.SessionLogFilename = "c:/aaworkarea/httpLog.txt" // Create an HTTP request that has two additional params loo_Req = create oleobject // Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0 li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest") loo_Req.HttpVerb = "POST" loo_Req.Path = "/echoPost.asp?xyz=123&name=matt" loo_Req.AddParam("sport","tennis") loo_Req.AddParam("tournament","French Open") // Send the HTTP POST and get the response. loo_Resp = loo_Http.SynchronousRequest("www.chilkatsoft.com",80,0,loo_Req) if loo_Http.LastMethodSuccess = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_Req return end if Write-Debug loo_Resp.BodyStr destroy loo_Resp Write-Debug "Success." destroy loo_Http destroy loo_Req |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.