Sample code for 30+ languages & platforms
PowerBuilder

HTTP POST x-www-form-urlencoded

Demonstrates how to send a simple URL encoded POST (content-type = x-www-form-urlencoded). Form params are passed in the HTTP request body in x-www-form-urlencoded format.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
long li_Success
oleobject loo_Http
oleobject loo_Req
oleobject loo_Resp

li_Success = 0

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

loo_Http = create oleobject
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

loo_Req = create oleobject
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")

//  Add the request params expected by the server-side:
loo_Req.AddParam("city","Paris")
loo_Req.AddParam("country","France")

//  Send the POST
loo_Req.HttpVerb = "POST"
loo_Req.ContentType = "application/x-www-form-urlencoded"

loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")

li_Success = loo_Http.HttpReq("http://www.chilkatsoft.com/httpTest/cityCountry.asp",loo_Req,loo_Resp)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_Req
    destroy loo_Resp
    return
end if

//  The exact HTTP request sent and response received
//  by the example code above is as follows:

//  ---- Sending ----
//  POST /httpTest/cityCountry.asp HTTP/1.1
//  Host: www.chilkatsoft.com
//  Content-Type: application/x-www-form-urlencoded
//  Content-Length: 25
//  
//  city=Paris&country=France
//  ---- Received ----
//  HTTP/1.1 200 OK
//  Date: Wed, 09 Dec 2009 16:16:00 GMT
//  Server: Microsoft-IIS/6.0
//  X-Powered-By: ASP.NET
//  Content-Length: 156
//  Content-Type: text/html
//  Set-Cookie: ASPSESSIONIDQCDTSSAC=MHJCNFMDENFOKGINOFEDILCM; path=/
//  Cache-control: private
//  
//  
//  <html>
//  <head>
//  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
//  </head>
//  <body>
//  
//  France<br />Paris<br />
//  
//  </body>
//  </html>


destroy loo_Http
destroy loo_Req
destroy loo_Resp