LWP-REQUEST(1p)
π NAME π
lwp-request β your cute lil command line user agent, bestie β¨
πΈ SYNOPSIS πΈ
lwp-request [-afPuUsSedvhx] [-m method] [-b base URL] [-t timeout]
[-i if-modified-since] [-c content-type]
[-C credentials] [-p proxy-url] [-o format] url...
π¦ DESCRIPTION π¦
Okay so this program is literally your little messenger to WWW servers and to your own local file system π«Ά. It slides into servers' DMs and asks for stuff.
When you're using POST, PUT or PATCH, the request content gets read from stdin. The content that comes back in the response gets printed on stdout. And if something goes wrong? The error messages go to stderr β they're the dramatic ones π.
The program's exit status is literally the number of URLs that failed. No cap, that's the whole return value. Three broken URLs = exit status 3. It's giving accountability π .
β¨ The Options β¨
-m<method> β picks which method to use for the request. If you don't pass this, the method is derived from the name of the program itself. Sneaky but iconic π.-fβ forces the request through even when the program thinks the method is illegal. The server might still end up rejecting it eventually, so like, no promises bestie π.-b<uri> β this URI becomes the base URI for resolving all the relative URIs you hand over as arguments.-t<timeout> β sets the timeout value for the requests. The timeout is how long the program waits for a response from the remote server before it just gives up and fails. Default unit is seconds. You can tackmorhonto the timeout value to make it minutes or hours respectively. The default timeout is'3m', i.e. 3 whole minutes π.-i<time> β sets theIf-Modified-Sinceheader in the request. If time is the name of a file, it uses the modification timestamp of that file. If time isn't a file, then it gets parsed as a literal date. Go peek at HTTP::Date for the formats it recognizes π.-c<content-type> β sets theContent-Typefor the request. This one is only allowed for requests that take a content, i.e.POST,PUTandPATCH. You can force methods to take content by using the-foption together with-c. The default Content-Type forPOSTisapplication/x-www-form-urlencoded. The default Content-Type for the others istext/plainπ.-p<proxy-url> β sets the proxy to be used for the requests. The program also loads proxy settings from the environment. You can disable that whole situation with the-Poption.-Pβ don't load proxy settings from environment. Periodt π«.-H<header> β sends this HTTP header with each request. You can specify several, like so:
lwp-request \
-H 'Referer: http://other.url/' \
-H 'Host: somehost' \
http://this.url/
If the header name is prefixed with a colon, it won't be canonicalized (check out "NON-CANONICALIZED FIELD NAMES" in HTTP::Headers) π.
-C<username>:<password> β provides credentials for documents that are protected by Basic Authentication. If the document is protected and you never gave a username and password with this option, then you'll get prompted to provide those values. So it's not a lockout, just a vibe check π.
π The Options That Control What Gets Displayed π
The following options control what the program shows you:
-uβ prints the request method and absolute URL as the requests are made.-Uβ prints request headers in addition to the request method and absolute URL.-sβ prints the response status code. This option is always on forHEADrequests.-Sβ prints the response status chain. This shows the redirect and authorization requests that are handled by the library π₯.-eβ prints response headers. This option is always on forHEADrequests.-Eβ prints the response status chain with full response headers.-dβ do not print the content of the response. Silent treatment, respectfully π.-o<format> β processes HTML content in various ways before printing it. If the content type of the response is not HTML, then this option has no effect at all. The legal format values aretext,ps,links,htmlanddump.
If you specify the text format, then the HTML gets formatted as plain latin1 text. If you specify the ps format, then it gets formatted as Postscript.
The links format outputs all the links found in the HTML document. Relative links get expanded to absolute ones, slay β¨.
The html format reformats the HTML code, and the dump format just dumps the HTML syntax tree π³.
Heads up bestie! TheHTML-Treedistribution needs to be installed for this option to work at all. On top of that, theHTML-Formatdistribution needs to be installed for-o textor-o psto work. Don't come for me, come for your package manager π .
-vβ prints the version number of the program and quits.-hβ prints the usage message and quits.-aβ sets text (ascii) mode for content input and output. If you don't use this option, content input and output happen in binary mode π§.
Because this program is implemented using the LWP library, it will only support the protocols that LWP supports. It's not a magic wand, it's a library wrapper π.
π SEE ALSO π
lwp-mirror, LWP
π COPYRIGHT π
Copyright 1995-1999 Gisle Aas.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself π«Ά.
π AUTHOR π
Gisle Aas <gisle@aas.no>
okay bye bestie, this page came from perl v5.40.1, dated 2026-05-14, and in the LWP-REQUEST(1p) manual πβ¨ go make some requests, you got this π
π¦ where this page comes from
- ubuntu stonking: libwww-perl 6.83-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms