Reference > Script steps reference > Fields script steps > Insert From URL
 
Insert From URL
Purpose 
Enters the content from a URL into a field or variable.
See also 
Format 
Insert from URL [Verify SSL Certificates; Select; With dialog: On/Off; <table::field or variable>; <resource URL>; <cURL options>]
Options 
Verify SSL Certificates verifies the SSL certificate of the server specified in the URL. If the certificate cannot be verified, users can choose to connect anyway or cancel to skip this script step. If the certificate cannot be verified and the Set Error Capture script step is set to On, Insert From URL behaves as if the server were unavailable.
Select entire contents replaces the contents of a field or variable. If you don’t select this option:
For a field, replaces only the selected portion of the active field, or inserts data at the insertion point. The default insertion point is at the end of the field's data.
For a variable that doesn’t have container data, inserts data at the end of the variable’s current value. For a variable that has container data, replaces the contents of the variable.
With dialog specifies whether to display the "Insert from URL" Options dialog box when the script step is performed.
Target specifies the field or variable to insert the URL content into. If the variable doesn’t exist, this script step creates it (see Using variables).
Specify URL allows you to type the URL or to create your URL from a calculation.
Automatically encode URL replaces special characters with the corresponding encoded values required for URLs. For example, a space character is replaced with %20. When this option is deselected, the URL remains as it is entered. cURL options are not encoded.
Specify cURL options allows you to enter one or more supported cURL options as a calculation. See Supported cURL options.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Partial 
Originated in 
FileMaker Pro 12.0
Description 
Insert From URL supports http, https, ftp, ftps, and file protocols. FileMaker Pro downloads the resource that is specified by the URL to a variable or a field.
You must specify a target variable, specify a target field on the current layout, click in a field, or use the Go to Field script step before performing this script step. If Target is not specified, the data is placed in the active field. Otherwise, this script step returns an error code that can be captured with the Get(LastError) function.
For a list of picture and audio/video formats supported in container fields, see Using data in container fields.
Important  For better performance in FileMaker WebDirect, be sure that Select entire contents is selected when the target is a field.
Notes 
Insert From URL supports only UTF-8 in Specify URL and in returned text. However, in Specify cURL options, you can control the character encoding of parameters. See Supported cURL options.
Specify cURL options is not supported in runtime solutions.
In FileMaker WebDirect:
If the With dialog option is On, this script step runs as if Automatically encode URL is selected.
If Select entire contents is deselected, and Insert From URL inserts content into a text field, the contents from the URL are appended to the text field. Multiple fetches can result in unpredictable results and slower performance.
The file protocol:
is not supported in FileMaker WebDirect and Custom Web Publishing
can be used in server-side scripts only to refer to files in the FileMaker Server Documents or temporary folder (see Paths in server-side scripts)
Example 1 
Accesses a website and inserts a PDF into the Sales Report container field.
Insert from URL [With dialog: Off; Customers::Sales Report; "http://www.filemaker.com/sales_report.pdf"]
Example 2 
Inserts a map showing the customer's address in the Address Map container field.
Insert from URL [With dialog: Off; Customers::Address Map; "http://maps.google.com/maps/api/staticmap?center=" & Customers::Address & "&zoom=14&markers=" & Customers::Address & "&size=256x256&sensor=false"]
Example 3 
Inserts the HTML code for http://www.apple.com.
Insert from URL [With dialog: Off; Customers::HTML Website Code; "http://www.apple.com"]
Example 4 
Uses the cURL options --user and --upload-file to upload a file from a container field to a server using the credentials myusername and mypassword, and stores any results from the server in the variable $$results. The filename on the server will be the same as the filename in the container field.
Set Variable [ $file ; Value: table::container ]
Insert from URL [Verify SSL Certificates; With dialog: Off; $$results ;
"https://www.filemaker.com/uploads";
"--user myusername:mypassword --upload-file $file
 --header \"Content-type: image/png\""]
Related topics 
Script steps reference (alphabetical list)
Script steps reference (category list)