[ic] posttourl.tag

Grant listbox at email.com
Fri Aug 29 16:01:12 EDT 2003

> Both HTTP::Headers and HTTP::Request have very good manual pages, and
> the changes to your code will be very simple.

After checking out the man pages on HTTP::Headers, I changed the "-"
characters in my headers to "_" and after another minor change, IC restarts
with the tag without any errors.  I feel like I'm close to a successful
POST.  I set up a test page to call the posttourl.tag and got a 500 error.
I noticed the following in my error.log:

[29/August/2003:10:18:24 -0700] path/test.html Runtime error: Can't locate
object method "X_API_COMPATIBILITY_LEVEL" via package "HTTP::Headers" at
/usr/lib/perl5/site_perl/5.6.0/HTTP/Message.pm line 189.

Can anyone interpret that error and point me in the right direction as far
as fixing it?  I'm calling posttourl.tag with the following code:

	# params are passed to posttourl via cgi to allow
	# fixed string with variable values
        my $page="";
	$CGI->{params}="<?xml version='1.0' encoding='iso-8859-1'?><request>a bunch
of XML</request>";
        $page.="Connecting to ".$CGI->{url}

        return $page;
[seti postonly]
[posttourl url="[cgi url]" params="[cgi params]" apicall="[cgi apicall]"]

and here's the posttourl.tag:

Usertag posttourl Order url params apicall
Usertag posttourl Routine <<EOR
use HTTP::Request;
use HTTP::Headers;
use LWP::UserAgent;
sub {
	my ($url,$params,$apicall) = @_;

	local($ENV{'HTTPS_VERSION'}) = '3';
	local($ENV{'HTTPS_CERT_FILE'}) = 'xxx.pem';
	local($ENV{'HTTPS_KEY_FILE'}) = 'xxx.key';

	my $request = new HTTP::Request('POST' => $url);

    	my $ua = new LWP::UserAgent;
    	my $response = $ua->request($request);

    	my $page = $response->as_string() . "\n\n\n";
    	$page .= $response->code() . "\n";
    	$page .= $response->message() . "\n";

    	return $page;

- Grant

More information about the interchange-users mailing list