tldr/pages/common/lwp-request.md

30 lines
849 B
Markdown
Raw Normal View History

2016-01-21 23:10:23 +00:00
# lwp-request
2016-01-24 07:05:29 +00:00
> Simple command-line HTTP client.
> Built with libwww-perl.
2019-06-05 08:55:58 +01:00
> More information: <https://metacpan.org/pod/lwp-request>.
2016-01-21 23:10:23 +00:00
- Make a simple GET request:
`lwp-request -m GET {{http://example.com/some/path}}`
- Upload a file with a POST request:
`cat {{/path/to/file}} | lwp-request -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}}`