[ic] HTTP POSTing to another server from IC

Marc Brevoort marc.brevoort at armazemdedados.com
Thu Aug 21 18:03:19 EDT 2003

On Wed, 2003-08-20 at 23:46, Grant wrote:
> I need to POST HTTP requests to another server from IC.  I've been all over
> this thread

Hey wait I remember that thread, that was me having the same problem ;) 

I just posted the tags but it still lacked a usage example, which was
also a bit tricky to put together. It basically comes down to:

	# params are passed to posttourl via cgi to allow
	# fixed string with variable values
        my $page="";
        $page.="Connecting to ".$CGI->{url}
        return $page;
[seti postonly]
[posttourl url="[cgi url]" params="[cgi params]"]
[seti fields]
[parsexml][posttourl url="[cgi url]" params="[cgi params]"][/parsexml]
	# post has been done, now interpret the results
	# xml variables have been dumped into flat CGI
        if (($CGI->{A085} ne "")||($CGI->{A085} ne "")) {
                return "Returned with error message: "
		.$CGI->{A077}." ".$CGI->{A078}
		."<!-- ".$Scratch->{"postonly"}." -->";
        if ($CGI->{C016} eq "") {
                return "Something didnt go 100%. Result of post is:"
		."<br> ".$Scratch->{"postonly"};
        return "All ok. Result is:<br> ".$CGI->{C016};

Only thing to watch out for is that the XML parser currently does flat
dumping (meaning, not preserving XML hierarchy). In my case that gave
enough detail, if in your case it doesn't, check out the documentation
of the perl XML parser module.


e-mail:	marc.brevoort at armazemdedados.com
web:	http://www.armazemdedados.com

Armazem de Dados, Informatica, Lda
Dep. Desenvolvimento
Tel. +351 21 910 83 10 / Fax. +351- 21 910 83 19

More information about the interchange-users mailing list