Sample code for 30+ languages & platforms
Tcl

Demonstrate HttpRequest.RemoveAllParams

Demonstrates the effect of calling HttpRequest.RemoveAllParams.

Chilkat Tcl Downloads

Tcl

load ./chilkat.dll

set req [new_CkHttpRequest]

CkHttpRequest_put_HttpVerb $req "POST"
CkHttpRequest_put_Path $req "/test123"
CkHttpRequest_put_ContentType $req "application/x-www-form-urlencoded"
CkHttpRequest_AddParam $req "paramA" "AAA"
CkHttpRequest_AddParam $req "paramB" "BBB"
CkHttpRequest_AddParam $req "paramC" "CCC"

puts [CkHttpRequest_generateRequestText $req]
puts "---------------"

# Generates: 

# 	POST /test123 HTTP/1.1
# 	Content-Type: application/x-www-form-urlencoded
# 	Host: domain
# 	Content-Length: 32
# 
# 	paramA=AAA&paramB=BBB&paramC=CCC
# 

# If we call RemoveAllParams, and then add some additional params,
# then the original params are gone, and only the new params exist.
CkHttpRequest_RemoveAllParams $req
CkHttpRequest_AddParam $req "paramD" "DDD"
CkHttpRequest_AddParam $req "paramE" "EEE"
CkHttpRequest_AddParam $req "paramF" "FFF"
puts [CkHttpRequest_generateRequestText $req]
puts "---------------"

# Generates:

# 	POST /test123 HTTP/1.1
# 	Content-Type: application/x-www-form-urlencoded
# 	Host: domain
# 	Content-Length: 32
# 
# 	paramD=DDD&paramE=EEE&paramF=FFF

delete_CkHttpRequest $req