wiki:Documentation/ARexxAPI/GETURL

Version 2 (modified by AmigaPhil, 12 months ago) (diff)

--

Languages:

GETURL

NAME

GetURL -- Download a file from the World Wide Web using HTTP. (V2.1)

TEMPLATE

URL/A,FILENAME/A

FUNCTION

Downloads a file from the World Wide Web by HTTP and saves it to disk.

INPUTS

URL/A - complete URL to the file
FILENAME/A - complete filename to write the file to

RETURNS

RC is set to 5 if a TCP/IP stack is not running, or 10 if it is actually running but not online, if the URL cannot be found, or if the output filename cannot be written to.

NOTES

The "http://" introducer is optional, but otherwise the only one supported.

EXAMPLE

/* Enable result codes */

OPTIONS RESULTS

/* Ignore possible error from GETURL */

OPTIONS FAILAT 11

/* Download a file */

GETURL 'http://yam.ch/files/YAM22.lha' 'ram:YAM22.lha'

/* Report results */

c = RC
SELECT

WHEN c = 5 THEN SAY 'TCP/IP stack not running.'
WHEN c > 5 THEN SAY 'Error.'
OTHERWISE SAY 'File downloaded successfully.'

END

BUGS

The command is interrupted if email is sent or received.

SEE ALSO