]> git.lizzy.rs Git - plan9front.git/blob - sys/man/1/hget
hget(1): fix man page errors, add another example
[plan9front.git] / sys / man / 1 / hget
1 .TH HGET 1
2 .SH NAME
3 hget, formpost \- retrieve, post to a web page corresponding to a url
4 .SH SYNOPSIS
5 .B hget
6 [
7 .B -o
8 .I file
9 ] [
10 .B -p
11 .I body
12 |
13 .B -P
14 ] [
15 .B -r
16 .I header
17 ] [
18 .B -m
19 .I method
20 ] [
21 .B -b
22 .I baseurl
23 ]
24 .I url
25 .PP
26 .B formpost
27 [
28 .B -d
29 ] [
30 .B -M
31 ] [
32 .B -u
33 .I url
34 ] [
35 .B -g
36 .I action
37 ] [
38 .B -p
39 .I action
40 ] [
41 .B -m
42 .I action
43 ] [
44 .I name:value
45 |
46 .I name:@value
47 ]
48 .I ...
49 .SH DESCRIPTION
50 .I Hget
51 retrieves the web page specified by the URL
52 .I url
53 and writes it, absent the
54 .B -o
55 option, to standard output.
56 .PP
57 The
58 .I url
59 can be a relative path like
60 .B ../index.html
61 if a absolute
62 .I baseurl
63 was specified with the
64 .B -b
65 option.
66 .PP
67 If
68 .I url
69 is of type HTTP and the
70 .B -p
71 or
72 .B -P
73 options are specified, then a HTTP POST is performed.
74 With
75 .B -p
76 the data to be posted is provided by the
77 .I body
78 argument as a string or alternatively with
79 .B -P
80 read from standard input.
81 .PP
82 The
83 .B -o
84 option is used to keep a local file in sync with a
85 web page.  If the web page has been modified later than the
86 file, it is copied into the file.  If the file is up to date
87 but incomplete,
88 .I hget
89 will fetch the missing bytes.
90 .PP
91 Option
92 .B -r
93 sends an arbitrary HTTP
94 .IR header .
95 .PP
96 Option
97 .B -m
98 overrides the HTTP method used for the request.
99 .PP
100 .I Formpost
101 retrieves the web page specified by the URL
102 .I url,
103 parses its HTML for form data, then prints
104 .I hget
105 commands to submit forms to the
106 .I url.
107 If the
108 .B -M, -g, -p
109 or
110 .B -m
111 flags are set, the
112 .I hget
113 commands are assembled without first retrieving and interpreting the
114 target HTML.
115 .PP
116 If the
117 .B -d
118 flag is specified, debugging information is written
119 to the file
120 .B formpost.log
121 in the current directory.
122 .PP
123 The
124 .B -M
125 flag applies multipart/form-data encoding to the
126 remaining arguments and prints the result on
127 the standard output.
128 .PP
129 The
130 .B -u
131 flag sets the target URL to
132 .I url.
133 .PP
134 The
135 .B -g
136 and
137 .B -p
138 flags set the form method to GET and POST, respectively. The
139 .B -m
140 flag sets the form method to POST and its enctype to multipart/form-data.
141 In all cases, the form action is set to
142 .I action.
143 .PP
144 The remaining arguments of the form
145 .B name:value
146 are interpreted as form field names and values to be submitted. An
147 argument of the form
148 .B name:@value
149 is interpreted as a file upload, with the information following the
150 .B @
151 symbol treated as the full path to the location of the file.
152 .SH EXAMPLES
153 Retrieve the
154 .I hget
155 command needed to submit a form, which may then be
156 edited and sent.
157 .IP
158 .EX
159 % formpost -u http://p.intma.in
160 hget -p 'text=' http://p.intma.in/paste.cgi
161 .EE
162 .PP
163 Manually specify options to be sent to a given
164 .I url.
165 .IP
166 .EX
167 % formpost -u http://p.intma.in -p paste.cgi 'text:test post'
168 hget -p 'text=test+post' http://p.intma.in/paste.cgi
169 .EE
170 .PP
171 Upload a file.
172 .IP
173 .EX
174 % formpost -M file:@/tmp/screen.png | \\
175 hget -P \\
176 -r 'Content-Type: multipart/form-data, boundary=HJBOUNDARY' \\
177 http://i.intma.in/up.cgi
178 .EE
179 .SH SOURCE
180 .B /rc/bin/hget
181 .br
182 .B /rc/bin/formpost
183 .SH "SEE ALSO"
184 .IR webfs (4) ,
185 .IR ftpfs (4)
186 .SH DIAGNOSTICS
187 .I Hget
188 requires 
189 .IR webfs (4)
190 service mounted on
191 .B /mnt/web
192 to work.
193 .SH BUGS
194 .I Formpost
195 does not attempt to insert default values for
196 .B <select>
197 tags.