-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcall-web.html
executable file
·421 lines (391 loc) · 26.7 KB
/
call-web.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
<!DOCTYPE html>
<html lang="en">
<head>
<!--__GOLF_REDIRECT__-->
<title>Call web</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="HandheldFriendly" content="True"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="canonical" href="https://golf-lang.com/call-web.html" />
<style>
body, html {
color:black;
text-rendering: optimizelegibility;
background-color: white;
min-height: 150%;
font-family: "Times New Roman";
font-weight:400;
font-size:18px;
line-height:27px;
letter-spacing: 2px;
z-index: 1;
height: 100%;
text-align:left;
width:80%;
margin-left:auto;
margin-right:auto;
padding:0;
/*font-family: Helvetica, Arial, sans-serif;*/
}
body {
padding-left:1vw;
padding-right:1vw;
}
.ncode {
line-height:20px;
letter-spacing: 0px;
font-size:14px;
font-family: monospace;
display:inline-block;
max-width:100%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:15px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.shcode {
line-height:23px;
letter-spacing: 0px;
font-size:14px;
font-family: monospace;
display:inline-block;
max-width:100%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:15px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.sqlcode {
line-height:23px;
letter-spacing: 0px;
font-size:14px;
font-family: monospace;
display:inline-block;
max-width:100%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:15px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.htmlcode {
line-height:23px;
letter-spacing: 0px;
font-size:14px;
font-family: monospace;
display:inline-block;
max-width:100%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:15px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
.code {
line-height:23px;
letter-spacing: 0px;
font-size:14px;
font-family: monospace;
display:inline-block;
max-width:100%;
min-width:90%;
margin:0;
padding:0;
padding-left:5px;
padding-top:3px;
padding-bottom:3px;
margin-bottom:15px;
border: 2px solid #d6d6d6;
background-color:#f5f7f4;
white-space:nowrap;
}
/*Just like h1 but for pdf conversion it would be indented this way it's not*/
.vhub {
display: block;
font-size: 1.6em;
margin-top: 0.63em;
margin-bottom: 0.63em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
/*Just like h2 but for pdf conversion it would be indented this way it's not*/
.vsub {
display: block;
font-size: 1.25em;
margin-top: 0.53em;
margin-bottom: 0.53em;
margin-left: 0;
margin-right: 0;
font-weight: bold;
}
ul {
margin-left: 0.75vw;
padding-left: 0;
}
li {
margin-left: 0.75vw;
padding-left: 0;
}
/* this must be last, as it overrides previous settings, for mobile */
@media (hover: none) {
a {
display: inline-block;
padding-top: 3px;
padding-bottom: 2px;
}
body {
padding-left:2vw;
padding-right:2vw;
font-size:14px;
line-height:22px;
letter-spacing: 1px;
}
}
/*The following is for code snippets that are highlighted by 2html vim*/
pre { overflow-x: scroll; margin:0; padding:0; font-family:monospace; }
.Identifier { color: #008b8b; }
.Statement { color: #af5f00; }
.PreProc { color: #5fd7ff; }
.Type { color: #005f00; }
.Comment { color: blue ; }
.Constant { color: #ff00ff; }
/*end of highlighted snippets*/
a {
text-decoration:none;
padding-bottom: 0px;
color:inherit;
border-bottom: 2px solid #6cb8f0;
}
a:hover {
text-decoration: none;
color:black;
border-bottom: 1px solid red;
}
/*do not underline links nor should they be active*/
pre a {
text-decoration:none;
color:black;
border-bottom: none;
pointer-events: none;
cursor: default;
}
.golfSnippet {display:none;}
ul {
list-style-type:square;
list-style-position: outside;
}
</style>
</head>
<body>
<script>
function gg_copy(gt, eid, gc) {
gt.textContent = eid.textContent;
gt.select();
document.execCommand("copy");
gc.style.visibility="visible"
setTimeout(()=>{ gc.style.visibility="hidden"; }, 1000);
}
</script>
<!--GOLFMENU13-->
<!--GOLFENDMENU13-->
<!--BEGVDOC90-->
<div class='vhub' style='margin-top:10px;margin-right:20px;text-align:right;background-color:white;'><a href='https://golf-lang.com' style='border-bottom:0px'><img src='https://golf-lang.com/golf.png'/></a></div><div class='vhub' style='margin-top:10px;'> Call web</div><hr/><span style="font-weight:bold;">Purpose</span>: Get content of URL resource (call a web address).<br/>
<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_265'>
<span class="Statement"> call-web</span> <URL> \
<span class="Type"> response</span> <result> \
[<span class="Type"> response-code</span> <response code> ] \
[<span class="Type"> response-headers</span> <headers> ] \
[<span class="Type"> status</span> <status> ] \
[<span class="Identifier"> method</span> <request method> ] \
[<span class="Identifier"> request-headers</span> \
[<span class="Identifier"> content-type</span> <content type> ] \
[<span class="Identifier"> content-length</span> <content length> ] \
<span class="Identifier"> custom</span> <header name>=<header value> [ , ... ] ] \
[<span class="Identifier"> request-body</span> \
( [<span class="Identifier"> fields</span> <field name>=<field value> [ , ... ] ] \
[<span class="Identifier"> files</span> <file name>=<file location> [ , ... ] ] ) \
| \
(<span class="Identifier"> content</span> <body content> ) \
] \
[<span class="Type"> error</span> <error> ] \
[<span class="Identifier"> cert</span> <certificate> |<span class="Identifier"> no-cert</span> ] \
[<span class="Identifier"> cookie-jar</span> <cookie jar> ] \
[<span class="Identifier"> timeout</span> <timeout> ]</pre>
<span id=golf_copied_265 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_265' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_265, code_265, golf_copied_265)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
With call-web, you can get the content of any accessible URL resource, for example web page, image, PDF document, XML document, REST API etc. It allows you to programmatically download URL's content, including the header. For instance, you might want to obtain (i.e. download) the source code of a web page and its HTTP headers. You can then save such downloaded items into files, analyze them, or do anything else.<br/>
<br/>
<URL> is the resource locator, for example "https://some.web.page.com" or if you are downloading an image (for instance) it could be "https://web.page.com/image.jpg". Anything you can access from a client (such as web browser), you can also obtain programmatically. You can specify any URL parameters, for example "https://some.web.page.com?par1=val1&par2=val2".<br/>
<div class="vsub"><a id="Response and headers"></a>Response and headers</div>
The result is obtained via "response" clause into variable <result>, and the length (in bytes) of such response is obtained via "status" clause in <status> variable. <br/>
<br/>
The response code (such as 200 for "OK", 404 for "Not Found" etc.) is available via "response-code" clause in number <response code>; the default value is 0 if response code is unavailable (due to error for instance).<br/>
<br/>
"response-headers" clause allows for retrieval of response headers (such as HTTP headers) in <headers> variable, as a single string variable. <br/>
<div class="vsub"><a id="Request method"></a>Request method</div>
You can specify the request method using "method" clause. <method> has a string value of the request method, such as "GET", "POST", "PUT", "PATCH", "DELETE" or any other.<br/>
<div class="vsub"><a id="Status"></a>Status</div>
In case of error, <status> is negative, and has value of GG_ERR_FAILED (typically indicating system issue, such as lack of memory, library or system issue or local permissions), GG_ERR_WEB_CALL (error in accessing URL or obtaining data) - otherwise <status> is the length in bytes of the response (0 or positive). Optionally, you can obtain the error message (if any) via "error" clause in <error> variable. Error is an empty string ("") if there is no error.<br/>
<div class="vsub"><a id="Timeout"></a>Timeout</div>
If "timeout" clause is specified, call-web will timeout if operation has not completed within <timeout> seconds. If this clause is not specified, the default timeout is 120 seconds. If timeout occurs, <status> will be GG_ERR_WEB_CALL and <error> will indicate timeout. Timeout cannot be negative nor greater than 86400 seconds.<br/>
<div class="vsub"><a id="HTTPS and certificates"></a>HTTPS and certificates</div>
You can call any valid URL that uses protocol supported by the underlying library (cURL). If you're using https protocol (or any other that requires a SSL/TSL certificate), you can either use the local CA (certificate authority) issued, specify the location of a certificate with "cert" clause, or if you do not want it checked, use "no-cert". By default, the locally installed certificates are used; if the URL you are visiting is not trusted via those certificates, and you still want to visit it, use "no-cert"; and if you do have a no-CA (i.e. self-signed certificate) for that URL, use "cert" to provide it as a file name (either a full path or a name relative to current working directory, see <a href='https://golf-lang.com/directories.html'>directories</a>).<br/>
<div class="vsub"><a id="Cookies"></a>Cookies</div>
If you'd like to obtain cookies (for example to maintain session or examine their values), use "cookie-jar" clause. <cookie jar> specifies the location of a file holding cookies. Cookies are read from this file (which can be empty or non-existent to begin with) before making a call-web and any changes to cookies are reflected in this file after the call. This way, multiple calls to the same server maintain cookies the same way browser would do. Make sure the same <cookie jar> file is not used across different application spaces, meaning it should be under the application home directory (see <a href='https://golf-lang.com/directories.html'>directories</a>), which is the most likely method of implementation.<br/>
<div class="vsub"><a id="Binary result"></a>Binary result</div>
The result of call-web (which is <result>) can be a text value or a binary value (for example if getting "JPG", "PNG", "PDF" or other documents). Either way, <status> is the number of bytes in a buffer that holds the value, which is also the value's <a href='https://golf-lang.com/string-length.html'>string-length</a>.<br/>
<div class="vsub"><a id="Request body, sending files and arbitrary content"></a>Request body, sending files and arbitrary content</div>
In order to include request body, for instance to send files, use "request-body" clause. Request body is typically used with POST, PUT or PATCH methods. Even though not common, you can also use it with GET, DELETE or any other custom method, such as for example if the resource you wish to identify requires binary data; perhaps a disposable image is used to identify the resource. <br/>
<br/>
<span style="font-weight:bold;">- Structured content</span><br/>
Use "fields" and/or "files" subclauses to send a structured body request in the form of name/value pairs, the same as sent from an HTML form. To do that, you can specify fields with "fields" subclause in the form of <field name>=<field value> pairs separated by a comma. For instance, here two fields are set (field "source" with value "web" and field "act" with value "setcookie"):<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_266'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="http://website.com/app_name/some_request">http://website.com/app_name/some_request</a>"</span><span class="Type"> response</span> resp<span class="Type"> response-code</span> rc<span class="Type"> status</span> len \
<span class="Identifier"> request-body fields</span> <span class="Constant">"source"</span>=<span class="Constant">"web"</span>,<span class="Constant">"act"</span>=<span class="Constant">"setcookie"</span></pre>
<span id=golf_copied_266 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_266' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_266, code_266, golf_copied_266)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
To include files, use "files" subclause in the form of <file name>=<file location> separated by commas. For example, here "file1" is the file name sent (which can be anything), and local file "uploadtest.jpg" is the file whose contents is sent; and "file23" is the file name sent (which can be anything), and "fileup4.pdf" is the actual local file read and sent. In this case files are in the application home directory (see <a href='https://golf-lang.com/directories.html'>directories</a>), but in general you can specify a relative or absolute path:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_267'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="http://website.com">http://website.com</a>"</span><span class="Type"> response</span> resp<span class="Type"> response-code</span> rc<span class="Type"> status</span> len \
<span class="Identifier"> request-body files</span> <span class="Constant">"file1"</span>=<span class="Constant">"uploadtest.jpg"</span>, <span class="Constant">"file23"</span>=<span class="Constant">"fileup4.pdf"</span></pre>
<span id=golf_copied_267 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_267' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_267, code_267, golf_copied_267)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
You can specify both "files" and "fields" fields, for instance (along with getting error text and status):<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_268'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="http://website.com/app_name/some_request">http://website.com/app_name/some_request</a>"</span><span class="Type"> response</span> resp<span class="Type"> response-code</span> rc
<span class="Statement"> request-body</span> fields <span class="Constant">"source"</span>=<span class="Constant">"web"</span>,<span class="Constant">"act"</span>=<span class="Constant">"setcookie"</span> \
files <span class="Constant">"file1"</span>=<span class="Constant">"uploadtest.jpg"</span>, <span class="Constant">"file23"</span>=<span class="Constant">"fileup4.pdf"</span> \
status st error err</pre>
<span id=golf_copied_268 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_268' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_268, code_268, golf_copied_268)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
There is no limit on the number of files and fields you can specify, other than of the underlying HTTP protocol.<br/>
<br/>
<span style="font-weight:bold;">- Non-structured content</span><br/>
To send any arbitrary (non-structured) content in the request body, such as JSON text for example, use "content" subclause:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_269'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="https://website.com">https://website.com</a>"</span><span class="Type"> response</span> resp \
<span class="Identifier"> request-headers content-type</span> <span class="Constant">"application/json"</span> \
<span class="Identifier"> request-body content</span> <span class="Constant">"{ </span><span class="Special">\</span>
<span class="Constant"> </span><span class="Special">\"</span><span class="Constant">employee</span><span class="Special">\"</span><span class="Constant">: { </span><span class="Special">\</span>
<span class="Constant"> </span><span class="Special">\"</span><span class="Constant">name</span><span class="Special">\"</span><span class="Constant">: </span><span class="Special">\"</span><span class="Constant">sonoo</span><span class="Special">\"</span><span class="Constant">, </span><span class="Special">\</span>
<span class="Constant"> </span><span class="Special">\"</span><span class="Constant">salary</span><span class="Special">\"</span><span class="Constant">: 56000, </span><span class="Special">\</span>
<span class="Constant"> </span><span class="Special">\"</span><span class="Constant">married</span><span class="Special">\"</span><span class="Constant">: true </span><span class="Special">\</span>
<span class="Constant"> } </span><span class="Special">\</span>
<span class="Constant"> }"</span></pre>
<span id=golf_copied_269 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_269' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_269, code_269, golf_copied_269)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
<content length> number in "content-length" subclause (in "request-headers" clause) can be specified to denote the length of body content:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_270'>
<span class="Statement"> read-file</span> <span class="Constant">"somefile"</span><span class="Type"> to</span> file_contents<span class="Type"> status</span> file_length
<span class="Statement"> call-web</span> <span class="Constant">"<a href="https://website.com">https://website.com</a>"</span><span class="Type"> response</span> resp \
<span class="Identifier"> request-headers content-type</span> <span class="Constant">"image/jpeg"</span> \
<span class="Identifier"> request-headers content-length</span> file_length \
<span class="Identifier"> request-body content</span> file_contents</pre>
<span id=golf_copied_270 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_270' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_270, code_270, golf_copied_270)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
If "content-length" is not used, then it is assumed to be the length of string <content>.<br/>
<div class="vsub"><a id="Request headers"></a>Request headers</div>
If your request has a body (i.e. "request-body" clause is used), you can set the content type with "content-type" subclause of a request-headers clause:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_271'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="https://">https://</a><web address>/resource"</span> \
<span class="Identifier"> request-headers content-type</span> <span class="Constant">"application/json"</span> \
<span class="Identifier"> request-body content</span> some_json</pre>
<span id=golf_copied_271 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_271' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_271, code_271, golf_copied_271)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Note that using "content-type" without the request body may be ignored by the server processing your request or may cause it to consider the request invalid. If "content-type" is not used, the default is "multipart/form-data" if "fields" or "files" subclause(s) are used with "body-request" clause. Otherwise, if you use "content" subclause to send other types of data, you must set content type explicitly via "content-type" subclause of "request-headers" clause.<br/>
<br/>
You can also specify custom request headers with "request-headers" clause, using "custom" subclause with a list of <header name>=<header value> pairs separated by a comma. For example, here custom header "Golf-header" has value of "Some_ID", and "Another-Header" a value of "New_ID":<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_272'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="http://website.com/">http://website.com/</a><app name>/<request name>?act=get_file"</span><span class="Type"> response</span> resp<span class="Type"> response-code</span> rc<span class="Type"> status</span> len \
<span class="Identifier"> request-headers custom</span> <span class="Constant">"Golf-header"</span>=<span class="Constant">"Some_ID"</span>, <span class="Constant">"Another-Header"</span>=<span class="Constant">"New_ID"</span></pre>
<span id=golf_copied_272 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_272' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_272, code_272, golf_copied_272)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
On the receiving side you can get any such custom header by using "header" clause of the <a href='https://golf-lang.com/get-req.html'>get-req</a> statement:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_273'>
<span class="Statement"> get-req</span><span class="Identifier"> header</span> <span class="Constant">"Golf-header"</span><span class="Type"> to</span> hvh0
<span class="Statement"> get-req</span><span class="Identifier"> header</span> <span class="Constant">"Another-Header"</span><span class="Type"> to</span> hvh1</pre>
<span id=golf_copied_273 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_273' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_273, code_273, golf_copied_273)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
<div class="vsub"><a id="Examples"></a>Examples</div>
Get the web page and print it out:<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_263'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="https://website.com/page.html">https://website.com/page.html</a>"</span><span class="Type"> response</span> resp
<span class="Statement"> p-out</span> resp</pre>
<span id=golf_copied_263 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_263' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_263, code_263, golf_copied_263)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
Get the "JPG" image from the web and save it to a file "pic.jpg":<br/>
<div class='code' style='position:relative;padding-right:16px;'>
<pre id='code_264'>
<span class="Statement"> call-web</span> <span class="Constant">"<a href="https://website.com/images/someimg.jpg">https://website.com/images/someimg.jpg</a>"</span><span class="Type"> status</span> wlen<span class="Type"> response</span> resp
<span class="Statement"> write-file</span> <span class="Constant">"pic.jpg"</span><span class="Identifier"> from</span> resp<span class="Identifier"> length</span> wlen</pre>
<span id=golf_copied_264 style='position:absolute;right:-14px;top:-30px; cursor: pointer;visibility:hidden;background:white;'>Copied!</span>
<textarea id='golft_264' style='position: absolute;left: -500%;'></textarea>
<img src='https://golf-lang.com/golf-copy-small-1.png' id='golfb' onclick='gg_copy(golft_264, code_264, golf_copied_264)' style='position:absolute;right:0;top:0; cursor: pointer;opacity:0.5;'/>
</div><br/>
<!--BEFSAL13--><div class="vsub"><a id="See also"></a>See also</div>
<a name='Web'></a><span style="font-weight:bold;">Web</span><br/>
<a href='https://golf-lang.com/call-web.html'>call-web</a> <br/>
<a href='https://golf-lang.com/out-header.html'>out-header</a> <br/>
<a href='https://golf-lang.com/send-file.html'>send-file</a> <br/>
<a href='https://golf-lang.com/silent-header.html'>silent-header</a> <br/>
<span style="font-weight:bold;">See all</span> <br/>
<a href='https://golf-lang.com/documentation.html'>documentation</a><br/>
<!--ENDVDOC90-->
<br/><div style='width:100%;clear:both;'>
<hr/>
<!--GOLFFOOT77--><span style='font-size:80%'><a href="https://golf-lang.com/copyright.html">Copyright</a> (c) 2019-2025 Gliim LLC. All contents on this web site is "AS IS" without warranties or guarantees of any kind.</span>
</div><br/></body></html>