(Tcl) Example: Http.QuickGetSb method
Demonstrates the QuickGetSb method.
load ./chilkat.dll
set success 0
set http [new_CkHttp]
# Send the HTTP GET and return the content in a StringBuilder
set sb [new_CkStringBuilder]
set success [CkHttp_QuickGetSb $http "https://www.chilkatsoft.com/helloWorld.json" $sb]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
if {[CkHttp_get_LastStatus $http] == 0} then {
# Communications error. We did not get a response.
puts [CkHttp_lastErrorText $http]
} else {
puts "Response status code: [CkHttp_get_LastStatus $http]"
puts "Response body error text:"
puts [CkStringBuilder_getAsString $sb]
}
delete_CkHttp $http
delete_CkStringBuilder $sb
exit
}
# The downloaded content:
puts [CkStringBuilder_getAsString $sb]
puts "Success"
delete_CkHttp $http
delete_CkStringBuilder $sb
|