[ic] HTTP POST
Tim Nelson
interchange-users@icdevgroup.org
Thu Feb 13 13:42:00 2003
-----Original Message-----
From: Marc Brevoort [mailto:marc.brevoort@armazemdedados.com]
Sent: Thursday, February 13, 2003 11:28 AM
To: interchange-users@icdevgroup.org
Subject: [ic] HTTP POST
Hello group,
I need to have the interchange server post a form to another server. A
perldoc lwpcook gives me the following script:
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST =>
'http://www.perl.com/cgi-bin/BugGlimpse');
$req->content_type('application/x-www-form-urlencoded');
$req->content('match=www&errors=0');
my $res = $ua->request($req);
print $res->as_string;
I've modified this to accept url and content, and tried to get it
working as tag and as subroutine included from catalog.cfg, but to my
frustration, all I'm getting is "Safe: require trapped by operation
mask" anytime I try to 'use LWP::UserAgent'.
Hoping to once and for all overcome these kind of limitations, how can I
make LWP::UserAgent (or any other library) available to my subroutine
without disabling safe mode? Pointers to real examples are especially
appreciated.
Regards,
Marc Brevoort
--
Marc Brevoort
e-mail: marc.brevoort@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
_______________________________________________
interchange-users mailing list
interchange-users@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-users
Marc,
I have a user tag that does (roughly) what you are attempting. Not sure...
but I think the reason mine
is working is a result of having AllowGlobal set....
UserTag getcontent Order url debug
UserTag getcontent Routine <<EOR
sub {
my($A,$debug,$url,$ua,$request,$response);
$url=$_[0];
$debug = $_[1];
eval {
require HTTP::Request;
require HTTP::Headers;
require LWP::UserAgent;
$ua = LWP::UserAgent->new;
$request = HTTP::Request->new(GET => $url);
$response = $ua->request($request);
if ($response->is_success) {
#print $response->headers_as_string();
#print $response->content;
$A = $response->content;
} else {
$A = $response->error_as_HTML;
}
};
return $A;
}
EOR