Silverfrost Logo About Us | Contact Us
 

Linking to the web

When whole URLs (i.e. URLs with '://' embeded in their name) are used within a <a>HREF=...</a> link in a (%ht) hypertext document, the default web browser is invoked to process the link.

A ClearWin+ routine is also available to perform this task:

SUBROUTINE USE_URL@(URL)
CHARACTER*(*) URL

This routine uses the Windows shell to open the URL. As a result it can be used to 'open' other objects such as a file with a name that has a registered extension (e.g. .DOC files). You can use this routine in a ClearWin+ window call-back function (attached to a menu item or button) in order to create a link to a web site or document.

This facility is also available via the INTERNET_HYPERLINK standard call-back function.

There is also a routine to read the contents of a URL (assuming the machine has access to the internet):

SUBROUTINE READ_URL@(URL,FILE,MODE,ERROR)
CHARACTER*(*) URL
CHARACTER*(*) FILE
INTEGER MODE
INTEGER ERROR

If this routine succeeds (i.e. an internet connection is available and the URL can be accessed), ERROR is set to zero and the data from the URL is transferred to the specified file (which can be a full path name). If MODE=0, the data is assumed to be text and new lines are converted to DOS style. If MODE=1, binary data is assumed.

The URL can be quite general. In particular, you can use an FTP address assuming anonymous access is possible, or an HTTP address with extra information attached. For example, you could query a search engine directly using this routine.

If necessary, the system will dial up the service provider to process this call. By default the connection will not be closed after the transfer has completed. The following call will close a modem connection if one exists.

CALL BREAK_MODEM_CONNECTION@

The function DOWNLOAD@ is similar to READ_URL@ but reads the download into memory.

 

 

Copyright © 1999-2017 Silverfrost Limited