3.2 Using the high-level interface

Using hURL's high-level interface is really easy. It is mostly used to extend Hollywood's DownloadFile() and UploadFile() commands to support SSL/TLS connections, which Hollywood itself doesn't support. To download a file using an SSL/TLS connection with hURL through the high-level interface, just do the following:

 
@REQUIRE "hurl"
url$ = "https://www.paypal.com/"
DownloadFile(url$, {File = "index.html", Adapter = "hurl"})

The code above will download the main page of https://www.paypal.com/ and save it as index.html.

By passing hurl in the Adapter tag you tell DownloadFile() to let hURL handle the download. The same is possible with UploadFile() and OpenConnection(). If you set the Adapter tag to hurl for those functions, the connection will automatically be managed by hURL, allowing you to use SSL/TLS encryption, for example.

Hollywood's DownloadFile(), UploadFile(), and OpenConnection() functions also have an SSL tag which you can set to True to tell hURL to enforce a connection via SSL/TLS. This is normally not necessary when passing schemes like https:// or ftps:// but can be useful for custom connections.


Show TOC