Gets the raw data of the specified URL. This can be for example the HTML of a web page.
Get URL [ Select ; Result ; Switches ; URL ]
|Select entire contents||replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field|
|Result||the raw data returned (or an error code)|
|Switches||this determines the behavior of the plug-in|
|URL||the url to get|
Switches can be one or more of these:
|-NoDialog||don’t display a progress dialog|
|-TimeoutTicks=x||specify the timeout time in x ticks (1/60th of a second)|
|-ReturnHeader||include the header in the returned text (at the beginning)|
|-ReturnDataAfterError||return the error code followed by the data|
|-Portnumber=y||specify the port number to use|
|-DontAutoRedirect||the plug-in will not go to a redirected page but return the original page|
|-AllowAnyRootCertificate||(for HTTPS) allow root certificates from unrecognized certification authorities. Note that this is less secure|
|-AlwaysSendUserPassword||directly send the username + password, even when this might not be necessary|
|-DontTryWithUserPassword||don’t send username + password when the web server requests authorization|
|-ExtraImageCheck||the plug-in will perform extra tests to determine if it is a known image type|
|-DontDetectEncoding||disable automatic UTF-8 encoding detection, instead keep the native encoding|
|-Encoding=UTF8||forces the resulting webpage to be interpreted as UTF-8|
Data type returned
If successful it returns the data of the URL. If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:
|$$-1||genericErr||the user cancelled|
|$$-4230||timeoutErr||the connection timed out|
|$$-3242||protocolErr||this protocol is not supported (use only http and https)|
|$$-30776||authnErr||authentication error, you need to supply a correct user name and password|
|$$-92||ddpLenErr||servername part of the url is too long|
|$$-2110||pathTooLongErr||path part of the url is too long|
Other errors may be returned, specifically errors in the range 300 to 599, which are HTTP Status Codes.
Troi URL Plug-in 5.0
FileMaker Pro 16
Secure connections (HTTPS) using SSL are also supported on Windows and Mac OS.
If you don’t specify a timeout, a default timeout of 15 seconds is used.
On Mac OS a progress dialog is displayed. On this platform you can also cancel a long operation with an ESC or a Command-Period.
The maximum length of the URL is limited, by both the plug-in and receiving servers. A lot of web servers don’t support URLs longer than 2048 characters. Note that the plug-in has higher limits of 32867 characters. See also the user guide for more info on these limits.
On Mac OS you may need to set cookies to get the desired result. See the TURL_SetCookies function.
Some images on the web don’t have a clear extension, or even have an extension GIF even if they are JPEGs! When using the switch -ExtraImageCheck the plug-in will perform extra tests to see if it is a known image type. If it is an image type, the plug-in returns the data as an image instead of the raw data as text.
The plug-in can automatically detect UTF-8 encoded web pages (and encode them correctly). This is enabled by default, and is determined by looking for the meta and charset tag in the HTML result of the Get URL script step. For an XML result the “encoding=utf-8” tag will also be detected.
Get URL [ Select ; Result ; "-unused" ; "http://www.example.com/" ]
This will return the specified web page. It will return something similar to:
<HTML><HEAD><TITLE>Example Web Page</TITLE></HEAD> <BODY><p>You have reached this web page by typing www.example.com. These domain names are reserved for use in documentation and are not available for registration.</p></BODY>/HTML>
We assume that in your FileMaker file the following fields are defined:
theURL Text gTimeOutTime Global, number
theURL should contain the URL, for example “http://www.filemaker.com”. In a script add the following script step:
Get URL [ Select ; ResultText ; "-NoDialog -TimeoutTicks="& gTimeOutTime ; theURL ]
This will get the data of the URL (the raw web page), without showing a dialog. If the server does not react the script step will timeout after gTimeOutTime ticks and an error code of “$$-4230” will be returned.
Related script steps