@@ -1305,11 +1305,52 @@ of hex digits with surrounding braces. For example:
1305
1305
1306
1306
{09531CF1-D0C7-4860-840C-1C8C8735E2AD}
1307
1307
1308
+ =item Win32::HttpGetFile(URL, FILENAME [, IGNORE_CERT_ERRORS])
1309
+
1310
+ Uses the WinHttp library to download the file specified by the URL
1311
+ parameter to the local file specified by FILENAME. The optional third
1312
+ parameter, if true, indicates that certficate errors are to be ignored
1313
+ for https connections; please use with caution in a safe environment,
1314
+ such as when testing locally using a self-signed certificate.
1315
+
1316
+ Only http and https protocols are supported. Authentication is not
1317
+ supported. The function is not available when building with gcc prior to
1318
+ 4.8.0 because the WinHttp library is not available.
1319
+
1320
+ In scalar context returns a boolean success or failure, and in list
1321
+ context also returns, in addition to the boolean status, a second
1322
+ value containing message text related to the status.
1323
+
1324
+ If the call fails, C<Win32::GetLastError() > will return a numeric
1325
+ error code, which may be a system error, a WinHttp error, or a
1326
+ user-defined error composed of 1e9 plus the HTTP status code.
1327
+
1328
+ Scalar context example:
1329
+
1330
+ print Win32::GetLastError()
1331
+ unless Win32::HttpGetFile('http://example.com/somefile.tar.gz',
1332
+ '.\file.tgz');
1333
+
1334
+ List context example:
1335
+
1336
+ my ($ok, $msg) = Win32::HttpGetFile('http://example.com/somefile.tar.gz',
1337
+ '.\file.tgz');
1338
+ if ($ok) {
1339
+ print "Success!: $msg\n";
1340
+ }
1341
+ else {
1342
+ print "Failure!: $msg\n";
1343
+ my $err = Win32::GetLastError();
1344
+ if ($err > 1e9) {
1345
+ printf "HTTP status: %d\n", ($err - 1e9);
1346
+ }
1347
+ }
1348
+
1308
1349
=item Win32::InitiateSystemShutdown
1309
1350
1310
1351
(MACHINE, MESSAGE, TIMEOUT, FORCECLOSE, REBOOT)
1311
1352
1312
- Shutsdown the specified MACHINE, notifying users with the
1353
+ Shuts down the specified MACHINE, notifying users with the
1313
1354
supplied MESSAGE, within the specified TIMEOUT interval. Forces
1314
1355
closing of all documents without prompting the user if FORCECLOSE is
1315
1356
true, and reboots the machine if REBOOT is true. This function works
0 commit comments