leszekdubiel has asked for the wisdom of the Perl Monks concerning the following question:
In bash I send HTTP request and get response like this:
#!/bin/bash curl -kv -X POST \ "https://my.webpage.com/my/path" \ --header 'My-Header: alfa' \ --header 'My-Header-2: beta' \ --data-raw 'here is my data'
How exactly can I do that in Perl?
#!/usr/bin/perl use Mojo::Message::Request; my $req = Mojo::Message::Request->new; $req->url->parse("https://my.webpage.com/my/path"); $req->method("POST"); $req->headers->header("My-Header", "alfa"); $req->headers->header("My-Header-2", "beta"); $req->body("here is my data"); ?? what here? ?? how to send that request to serwer my.webpage.com? ?? hot do I get response from server?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mojo instead of curl
by Corion (Patriarch) on Apr 14, 2023 at 11:52 UTC | |
by NERDVANA (Priest) on Apr 14, 2023 at 17:48 UTC | |
by Corion (Patriarch) on Apr 14, 2023 at 18:20 UTC | |
by NERDVANA (Priest) on Apr 14, 2023 at 19:53 UTC | |
|
Re: Mojo instead of curl
by Fletch (Bishop) on Apr 14, 2023 at 10:41 UTC | |
|
Re: Mojo instead of curl
by alexander_lunev (Pilgrim) on Apr 14, 2023 at 16:06 UTC | |
|
Re: Mojo instead of curl
by 1nickt (Canon) on Apr 14, 2023 at 17:07 UTC | |
by NERDVANA (Priest) on Apr 14, 2023 at 17:53 UTC |