Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

download file after perl post

Tags:

http

perl

This request returns a file of type ZIP how can I retrieve that file from that request?

# put timeouts, proxy etc into the useragent if needed
my $ua  = LWP::UserAgent->new();
my $req = POST $in_u, Content_Type => 'form-data', Content => $in_r;

my $response = $ua->request($req);

if ($response->is_success()) 
{
    print $response->content;
} 
like image 741
user391986 Avatar asked Dec 29 '25 11:12

user391986


1 Answers

I think you can use the content method on your $req object to get the raw content returned as a result of the POST. If the content is huge, then content_ref method is more suitable and offers to directly manipulate the content.

my $zfile = $req->content;

and crack on $zfile with Archive::Zip as DVK suggested.

like image 124
ashraf Avatar answered Jan 01 '26 10:01

ashraf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!