1LWP-REQUEST(1) User Contributed Perl Documentation LWP-REQUEST(1)
2
3
4
6 lwp-request - Simple command line user agent
7
9 lwp-request [-afPuUsSedvhx] [-m method] [-b base URL] [-t timeout]
10 [-i if-modified-since] [-c content-type]
11 [-C credentials] [-p proxy-url] [-o format] url...
12
14 This program can be used to send requests to WWW servers and your local
15 file system. The request content for POST and PUT methods is read from
16 stdin. The content of the response is printed on stdout. Error
17 messages are printed on stderr. The program returns a status value
18 indicating the number of URLs that failed.
19
20 The options are:
21
22 -m <method>
23 Set which method to use for the request. If this option is not
24 used, then the method is derived from the name of the program.
25
26 -f Force request through, even if the program believes that the method
27 is illegal. The server might reject the request eventually.
28
29 -b <uri>
30 This URI will be used as the base URI for resolving all relative
31 URIs given as argument.
32
33 -t <timeout>
34 Set the timeout value for the requests. The timeout is the amount
35 of time that the program will wait for a response from the remote
36 server before it fails. The default unit for the timeout value is
37 seconds. You might append "m" or "h" to the timeout value to make
38 it minutes or hours, respectively. The default timeout is '3m',
39 i.e. 3 minutes.
40
41 -i <time>
42 Set the If-Modified-Since header in the request. If time is the
43 name of a file, use the modification timestamp for this file. If
44 time is not a file, it is parsed as a literal date. Take a look at
45 HTTP::Date for recognized formats.
46
47 -c <content-type>
48 Set the Content-Type for the request. This option is only allowed
49 for requests that take a content, i.e. POST and PUT. You can force
50 methods to take content by using the "-f" option together with
51 "-c". The default Content-Type for POST is
52 "application/x-www-form-urlencoded". The default Content-type for
53 the others is "text/plain".
54
55 -p <proxy-url>
56 Set the proxy to be used for the requests. The program also loads
57 proxy settings from the environment. You can disable this with the
58 "-P" option.
59
60 -P Don't load proxy settings from environment.
61
62 -H <header>
63 Send this HTTP header with each request. You can specify several,
64 e.g.:
65
66 lwp-request \
67 -H 'Referer: http://other.url/' \
68 -H 'Host: somehost' \
69 http://this.url/
70
71 -C <username>:<password>
72 Provide credentials for documents that are protected by Basic
73 Authentication. If the document is protected and you did not
74 specify the username and password with this option, then you will
75 be prompted to provide these values.
76
77 The following options controls what is displayed by the program:
78
79 -u Print request method and absolute URL as requests are made.
80
81 -U Print request headers in addition to request method and absolute
82 URL.
83
84 -s Print response status code. This option is always on for HEAD
85 requests.
86
87 -S Print response status chain. This shows redirect and authorization
88 requests that are handled by the library.
89
90 -e Print response headers. This option is always on for HEAD
91 requests.
92
93 -E Print response status chain with full response headers.
94
95 -d Do not print the content of the response.
96
97 -o <format>
98 Process HTML content in various ways before printing it. If the
99 content type of the response is not HTML, then this option has no
100 effect. The legal format values are; "text", "ps", "links", "html"
101 and "dump".
102
103 If you specify the "text" format then the HTML will be formatted as
104 plain "latin1" text. If you specify the "ps" format then it will
105 be formatted as Postscript.
106
107 The "links" format will output all links found in the HTML
108 document. Relative links will be expanded to absolute ones.
109
110 The "html" format will reformat the HTML code and the "dump" format
111 will just dump the HTML syntax tree.
112
113 Note that the "HTML-Tree" distribution needs to be installed for
114 this option to work. In addition the "HTML-Format" distribution
115 needs to be installed for "-o text" or "-o ps" to work.
116
117 -v Print the version number of the program and quit.
118
119 -h Print usage message and quit.
120
121 -a Set text(ascii) mode for content input and output. If this option
122 is not used, content input and output is done in binary mode.
123
124 Because this program is implemented using the LWP library, it will only
125 support the protocols that LWP supports.
126
128 lwp-mirror, LWP
129
131 Copyright 1995-1999 Gisle Aas.
132
133 This library is free software; you can redistribute it and/or modify it
134 under the same terms as Perl itself.
135
137 Gisle Aas <gisle@aas.no>
138
139
140
141perl v5.38.0 2023-07-25 LWP-REQUEST(1)