Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How to download or run exe file using rest client.

by thanos1983 (Parson)
on Mar 19, 2019 at 16:18 UTC ( [id://1231438]=note: print w/replies, xml ) Need Help??


in reply to How to download or run exe file using rest client.

Hello Anonymous Monk,

What exactly are you trying to do? It sounds a bit strange to me to execute an .exe file from a REST client. A REST client could download a file e.g. from module LWP::Simple.pm/getstore.

Regarding on how to execute a file see How to run a .exe file from a Perl script?.

Looking forward to your reply.

BR / Thanos

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re^2: How to download or run exe file using rest client.
by Anonymous Monk on Mar 20, 2019 at 05:13 UTC

    Hi Thanks for the reply.

    Basically I am using Rest::client module to download the exe file, i could able to get the responsecontent but I am wondering how we can download the file itself using Rest::client module.

    Regards

      Hello again Anonymous Monk,

      I think I understand what you mean. I assume you are able to see the output of the page that you want to download but how to store it locally you mean.

      There are many ways to do it, sample below:

      #!/usr/bin/perl use strict; use warnings; use REST::Client; #The basic use case my $client = REST::Client->new(); $client->GET('https://perlmaven.com/'); print $client->responseContent(); __END__ $ perl test.pl > index.html

      Further documentation for reference of alternative ways how do i redirect STDOUT, STDIN, or STDERR to a FILE? and https://perlmaven.com/simple-way-to-fetch-many-web-pages.

      Let me know if still is not clear. BR / Thanos

      Seeking for Perl wisdom...on the process of learning...not there...yet!
        Hi Thanos

        Thanks for the reply, below code is working for me to get the exe file but while executing that file, I am facing "filename header error".

        use strict; use LWP::Simple; my $url = "URL"; ##die "Couldn't get it!" unless defined $content; my $file = "BCM_console.exe"; my $code = getstore($url, "$file"); print "CODE : $code\n";
        Are there any headers I need to pass here, how we can pass them.
        Regards.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1231438]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-03-29 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found