How to send request on a URL in Perl -
i want send request of xml on particular url , resposne there .how perl creating module.i new in perl please me .
you can try
package test::http; use strict; use warnings; use http::request; use lwp::useragent; use http::headers; sub new { $class = shift; $this = {}; bless $this, $class; return $this; } sub send_receive { $this = shift; $args = shift; $this->{pua} = lwp::useragent->new(); $this->{header} = http::headers->new; $this->{header}->header("content-type" => "text/xml", "soapaction" =>""); ($request, $response); $response = {}; eval { local $sig{alrm} = sub {die "timed out"}; alarm 90; $request = http::request->new( "post", $args->{url} , $args->{xml_request}); $response = $this->{pua}->simple_request($request); alarm 0; }; return $response->content; } sub destroy { $this = shift || return; } 1;
Comments
Post a Comment