cookersjs has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks, Hope you are well!
I am attempting to POST a text file to a local server, using port 8012.
I have been trying to do this using LWP::UserAgent. The main example I have been trying is found here.
Based on the example, I have produced the following code:
To get more specific about the codes purpose: I am running a docker container on a server that is communicated with via port 8012. The goal is to send a file here, process it and then return themy $ua = LWP::UserAgent->new; my $res = $ua->post('http://localhost:8012/', Content_Type => 'form_data', Content => [ Filedata => [ 'Hello.txt', 'Hello.txt', Content_Type => 'text/plain', ], submit => 'Submit', ], ); if ($res->is_success) { print $res->content; } else { print $res->status_line, "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Attempting to POST a file to local server
by Corion (Patriarch) on May 10, 2017 at 18:54 UTC | |
|
Re: Attempting to POST a file to local server
by cookersjs (Acolyte) on May 10, 2017 at 18:55 UTC | |
by tobyink (Canon) on May 11, 2017 at 08:22 UTC | |
by Anonymous Monk on May 11, 2017 at 08:37 UTC | |
by karlgoethebier (Abbot) on May 11, 2017 at 09:58 UTC | |
by tobyink (Canon) on May 11, 2017 at 19:59 UTC | |
by Anonymous Monk on May 11, 2017 at 19:17 UTC |