man-pages/man1/lwp-request.1p.html
2021-03-31 01:06:50 +01:00

246 lines
7.2 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of LWP-REQUEST</TITLE>
</HEAD><BODY>
<H1>LWP-REQUEST</H1>
Section: User Contributed Perl Documentation (1p)<BR>Updated: 2019-11-29<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
lwp-request - Simple command line user agent
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>lwp-request</B> [<B>-afPuUsSedvhx</B>] [<B>-m</B> <I>method</I>] [<B>-b</B> <I>base </I><FONT SIZE="-1"><I>URL</I></FONT><I></I>] [<B>-t</B> <I>timeout</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-i</B>&nbsp;<I>if-modified-since</I>]&nbsp;[<B>-c</B>&nbsp;<I>content-type</I>]
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<B>-C</B>&nbsp;<I>credentials</I>]&nbsp;[<B>-p</B>&nbsp;<I>proxy-url</I>]&nbsp;[<B>-o</B>&nbsp;<I>format</I>]&nbsp;<I>url</I>...
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
This program can be used to send requests to <FONT SIZE="-1">WWW</FONT> servers and your
local file system. The request content for <FONT SIZE="-1">POST</FONT> and <FONT SIZE="-1">PUT</FONT>
methods is read from stdin. The content of the response is printed on
stdout. Error messages are printed on stderr. The program returns a
status value indicating the number of URLs that failed.
<P>
The options are:
<DL COMPACT>
<DT id="1">-m &lt;method&gt;<DD>
Set which method to use for the request. If this option is not used,
then the method is derived from the name of the program.
<DT id="2">-f<DD>
Force request through, even if the program believes that the method is
illegal. The server might reject the request eventually.
<DT id="3">-b &lt;uri&gt;<DD>
This <FONT SIZE="-1">URI</FONT> will be used as the base <FONT SIZE="-1">URI</FONT> for resolving all relative URIs
given as argument.
<DT id="4">-t &lt;timeout&gt;<DD>
Set the timeout value for the requests. The timeout is the amount of
time that the program will wait for a response from the remote server
before it fails. The default unit for the timeout value is seconds.
You might append ``m'' or ``h'' to the timeout value to make it minutes or
hours, respectively. The default timeout is '3m', i.e. 3 minutes.
<DT id="5">-i &lt;time&gt;<DD>
Set the If-Modified-Since header in the request. If <I>time</I> is the
name of a file, use the modification timestamp for this file. If
<I>time</I> is not a file, it is parsed as a literal date. Take a look at
HTTP::Date for recognized formats.
<DT id="6">-c &lt;content-type&gt;<DD>
Set the Content-Type for the request. This option is only allowed for
requests that take a content, i.e. <FONT SIZE="-1">POST</FONT> and <FONT SIZE="-1">PUT.</FONT> You can
force methods to take content by using the <TT>&quot;-f&quot;</TT> option together with
<TT>&quot;-c&quot;</TT>. The default Content-Type for <FONT SIZE="-1">POST</FONT> is
<TT>&quot;application/x-www-form-urlencoded&quot;</TT>. The default Content-type for
the others is <TT>&quot;text/plain&quot;</TT>.
<DT id="7">-p &lt;proxy-url&gt;<DD>
Set the proxy to be used for the requests. The program also loads
proxy settings from the environment. You can disable this with the
<TT>&quot;-P&quot;</TT> option.
<DT id="8">-P<DD>
Don't load proxy settings from environment.
<DT id="9">-H &lt;header&gt;<DD>
Send this <FONT SIZE="-1">HTTP</FONT> header with each request. You can specify several, e.g.:
<P>
<PRE>
lwp-request \
-H 'Referer: <A HREF="http://other.url/'">http://other.url/'</A> \
-H 'Host: somehost' \
<A HREF="http://this.url/">http://this.url/</A>
</PRE>
<DT id="10">-C &lt;username&gt;:&lt;password&gt;<DD>
Provide credentials for documents that are protected by Basic
Authentication. If the document is protected and you did not specify
the username and password with this option, then you will be prompted
to provide these values.
</DL>
<P>
The following options controls what is displayed by the program:
<DL COMPACT>
<DT id="11">-u<DD>
Print request method and absolute <FONT SIZE="-1">URL</FONT> as requests are made.
<DT id="12">-U<DD>
Print request headers in addition to request method and absolute <FONT SIZE="-1">URL.</FONT>
<DT id="13">-s<DD>
Print response status code. This option is always on for <FONT SIZE="-1">HEAD</FONT> requests.
<DT id="14">-S<DD>
Print response status chain. This shows redirect and authorization
requests that are handled by the library.
<DT id="15">-e<DD>
Print response headers. This option is always on for <FONT SIZE="-1">HEAD</FONT> requests.
<DT id="16">-E<DD>
Print response status chain with full response headers.
<DT id="17">-d<DD>
Do <B>not</B> print the content of the response.
<DT id="18">-o &lt;format&gt;<DD>
Process <FONT SIZE="-1">HTML</FONT> content in various ways before printing it. If the
content type of the response is not <FONT SIZE="-1">HTML,</FONT> then this option has no
effect. The legal format values are; <TT>&quot;text&quot;</TT>, <TT>&quot;ps&quot;</TT>, <TT>&quot;links&quot;</TT>,
<TT>&quot;html&quot;</TT> and <TT>&quot;dump&quot;</TT>.
<P>
If you specify the <TT>&quot;text&quot;</TT> format then the <FONT SIZE="-1">HTML</FONT> will be formatted as
plain <TT>&quot;latin1&quot;</TT> text. If you specify the <TT>&quot;ps&quot;</TT> format then it will be
formatted as Postscript.
<P>
The <TT>&quot;links&quot;</TT> format will output all links found in the <FONT SIZE="-1">HTML</FONT> document.
Relative links will be expanded to absolute ones.
<P>
The <TT>&quot;html&quot;</TT> format will reformat the <FONT SIZE="-1">HTML</FONT> code and the <TT>&quot;dump&quot;</TT> format
will just dump the <FONT SIZE="-1">HTML</FONT> syntax tree.
<P>
Note that the <TT>&quot;HTML-Tree&quot;</TT> distribution needs to be installed for this
option to work. In addition the <TT>&quot;HTML-Format&quot;</TT> distribution needs to
be installed for <TT>&quot;-o text&quot;</TT> or <TT>&quot;-o ps&quot;</TT> to work.
<DT id="19">-v<DD>
Print the version number of the program and quit.
<DT id="20">-h<DD>
Print usage message and quit.
<DT id="21">-a<DD>
Set text(ascii) mode for content input and output. If this option is not
used, content input and output is done in binary mode.
</DL>
<P>
Because this program is implemented using the <FONT SIZE="-1">LWP</FONT> library, it will
only support the protocols that <FONT SIZE="-1">LWP</FONT> supports.
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
lwp-mirror, <FONT SIZE="-1">LWP</FONT>
<A NAME="lbAF">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 1995-1999 Gisle Aas.
<P>
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
<A NAME="lbAG">&nbsp;</A>
<H2>AUTHOR</H2>
Gisle Aas &lt;<A HREF="mailto:gisle@aas.no">gisle@aas.no</A>&gt;
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="22"><A HREF="#lbAB">NAME</A><DD>
<DT id="23"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="24"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="25"><A HREF="#lbAE">SEE ALSO</A><DD>
<DT id="26"><A HREF="#lbAF">COPYRIGHT</A><DD>
<DT id="27"><A HREF="#lbAG">AUTHOR</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:18 GMT, March 31, 2021
</BODY>
</HTML>