info("urltaskinfo")
info("urltaskinfo")

The info(“urltaskinfo”) function returns information about a just completed HTTP download.

Description

This function returns a dictionary with information about a just completed HTTP download. To do this, the first statement in the urltask( completion code should be the urltaskstatus statement. Then at a later point, the code can use the info(“urltaskinfo”) function to get a dictionary that contains all of the available information about the download.

This example downloads an image into a file. The filename is not specified, only the folder, so the filename returned from the web server will be used. After the download is complete the image will be opened in the Preview application.

    let siteurl=...
    let image=...
    let taskid = urltask(siteurl+image,
        "file","~/Pictures/WebStuff/",
        "code",{
            urltaskstatus
            local imagefile
            imagefile=getdictionaryvalue(info("urltaskinfo"),"FILENAME")
            openwith "Preview","~/Pictures/WebStuff/"+imagefile
        }
    )

The information available from the urltaskstatus function is:

`MIME` – Mime type of the returned data, for example `text/plain`, `text/html`, or `image/jpg`.

`FILENAME` – The filename suggested by the server for this content.

`ENCODING` – If the content is text, this is the encoding of the text, for example `UTF-8`. Note: This information is sometimes missing.

See Also

- encodehttppostdata( -- converts a dictionary into HTTP post data.
- info("httpheaders") -- returns a dictionary with information about a just completed HTTP download.
- ipaddress -- returns the current IP address of the computer, or "" if not connected.
- loadurl -- loads a resource from the internet.
- loadurl( -- loads a resource from the internet.
- posturl -- loads a resource from the internet, with form data.
- posturl( -- loads a resource from the internet, with form data.
- url( -- synchronously loads a resource from the internet.
- urltask( -- asynchronously loads a resource from the internet.
- urltaskcancel -- aborts a download initiated with the urltask( function.
- urltaskstatus -- enables connection error checking in urltask( completion code.
- zipinfo -- queries the web to obtain information about a zip code.
- zipinfoplus -- queries the web to obtain information about a zip code.

History

Version | Status | Notes
10.0 | New | New in this version.