Originally posted by Alisa Kennedy
Originally posted by Robert Milfajt
set curlHandle [curl::init]$curlHandle configure -url $url -post 1 -postfields "$msg" -httpheader $httpHeaders -headervar httpHeader -bodyvar httpBody
catch { $curlHandle perform } curlErrorNumberif { $curlErrorNumber != 0 } { echo "[curl::easystrerror $curlErrorNumber]"} else { set statCode [lindex [split $httpHeader(http) " "] 1] if {($statCode >= 100) && ($statCode <= 299)} { #successful http transfer, echo return regsub -all -- {n} $httpBody {} ack set fs [string index $ack 3] set segs [split $ack r] set MSA [lindex $segs [lsearch -regexp $segs {^MSA}]] set ackcode [lindex [split $MSA $fs] 1] if {$ackcode == "AA"} { echo "Successful transfer" lappend dispList "KILL $mh" } else { echo "HL7 NAK" lappend dispList "ERROR $mh" } } else { #failed http transfer, echo code echo "$httpHeader(http)" lappend dispList "ERROR $mh" }}$curlHandle cleanup