HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

lwp-request — Simple HTTP client. Built with libwww-perl. More information: <https://metacpan.org/pod/lwp-request>

Submitted by: @import:tldr-pages··
0
Viewed 0 times
simplehttpcommandclientlwp-requestcliwithbuilt

Problem

How to use the lwp-request command: Simple HTTP client. Built with libwww-perl. More information: <https://metacpan.org/pod/lwp-request>.

Solution

lwp-request — Simple HTTP client. Built with libwww-perl. More information: <https://metacpan.org/pod/lwp-request>.

Make a simple GET request:
lwp-request -m GET {{http://example.com/some/path}}


Upload a file with a POST request:
lwp-request < {{path/to/file}} -m POST {{http://example.com/some/path}}


Make a request with a custom user agent:
lwp-request -H 'User-Agent: {{user_agent}} -m {{METHOD}} {{http://example.com/some/path}}


Make a request with HTTP authentication:
lwp-request -C {{username}}:{{password}} -m {{METHOD}} {{http://example.com/some/path}}


Make a request and print request headers:
lwp-request -U -m {{METHOD}} {{http://example.com/some/path}}


Make a request and print response headers and status chain:
lwp-request -E -m {{METHOD}} {{http://example.com/some/path}}

Code Snippets

Make a simple GET request

lwp-request -m GET {{http://example.com/some/path}}

Upload a file with a POST request

lwp-request < {{path/to/file}} -m POST {{http://example.com/some/path}}

Make a request with a custom user agent

lwp-request -H 'User-Agent: {{user_agent}} -m {{METHOD}} {{http://example.com/some/path}}

Make a request with HTTP authentication

lwp-request -C {{username}}:{{password}} -m {{METHOD}} {{http://example.com/some/path}}

Make a request and print request headers

lwp-request -U -m {{METHOD}} {{http://example.com/some/path}}

Context

tldr-pages: common/lwp-request

Revisions (0)

No revisions yet.