Peter, Here are a couple of local subroutines I use for synchronizing records to other servers using a CGI post. The corresponding CGI program on the hosts generates a return value structured like...
SG: NUMBER.OF.ERRORS: SG: ERROR.MESSAGES Where SG is EQUATEd to CHAR(255), ERROR.MESSAGES is an attribute-delimited array of error messages and NUMBER.OF.ERRORS = DCOUNT(ERROR.MESSAGES, @AM). It makes it simple to make sure we got something legitimate back from the POST without having to interpret all the various http status codes. Hope this helps. Perry Taylor Zirmed, Inc. ! POST: POST.ERRMSG = NUL URL = 'http://': HOSTNAME: '/~http/cgi-bin/chglog.mirror.update.cgi' RV = createRequest(URL, 'POST', HDL) IF RV THEN POST.ERRMSG<-1> = 'creeateRequest() failure, retval=': RV: '.' POST.ERRMSG<-1> = 'URL=': URL RETURN END PARAM.NAME = 'ACTION' PARAM.VALUE = ACTION GOSUB POST.ADD.PARAM IF LEN(POST.ERRMSG) THEN RETURN PARAM.NAME = 'CHGLOGID' PARAM.VALUE = CHGLOG.ID GOSUB POST.ADD.PARAM IF LEN(POST.ERRMSG) THEN RETURN PARAM.NAME = 'CHGLOGREC' PARAM.VALUE = CHGLOG.REC GOSUB POST.ADD.PARAM IF LEN(POST.ERRMSG) THEN RETURN RESP.HDRS = NUL RESP.DATA = NUL HTTP.STATUS = NUL RV = submitRequest(HDL, NUL, NUL, RESP.HDRS, RESP.DATA, HTTP.STATUS) IF RV THEN POST.ERRMSG<-1> = 'submitRequest() failure, retval=': RV: '.' RETURN END IF RESP.DATA MATCHES '"': SG: '"1N0N"': SG: '"0X' THEN IF FIELD(RESP.DATA, SG, 2) THEN POST.ERRMSG<-1> = FIELD(RESP.DATA, SG, 3) END END ELSE POST.ERRMSG<-1> = 'Unexpected response from HTTP post.' POST.ERRMSG<-1> = STR('-', 79) POST.ERRMSG<-1> = RESP.DATA POST.ERRMSG<-1> = STR('-', 79) POST.ERRMSG<-1> = 'http status=': HTTP.STATUS END RETURN ! POST.ADD.PARAM: IF LEN(PARAM.NAME) ELSE POST.ERRMSG<-1> = 'No parameter name specified.' RETURN END RV = addRequestParameter(HDL, PARAM.NAME, PARAM.VALUE, NUL) IF RV THEN POST.ERRMSG<-1> = 'addRequestParameter() failure to added ' POST.ERRMSG := PARAM.NAME: ', retval=': RV: '.' END RETURN -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Veenhof Sent: Monday, January 09, 2006 7:38 AM To: u2-users@listserver.u2ug.org Subject: [U2] CallHTTP Hi all, Does anyone have a simple example of doing a HTTP POST from within Universe Basic? The documentation doesn't have any example code and I've failed to get it to work. Thanks Peter ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. ZirMed, Inc. has strict policies regarding the content of e-mail communications, specifically Protected Health Information, any communications containing such material will be returned to the originating party with such advisement noted. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/