Read data from URL on internet
The ReadFromUrl function, on the Database menu, reads text from URL sources, such as HTTP web pages or FTP sites.
ReadFromUrl(url, method, formValues, formFields, formIndex)
Reads text or images from a URL (Universal Resource Locator) location on the web. In most cases, this is called with a single parameter -- the URL. When reading from a web page, the URL should begin with 'http://....'. When reading a text file from an FTP site, it should begin with 'ftp://...'. The entire text from the requested location is returned as a text value. In most cases, you will need to write Analytica expressions to parse the data. When the URL is an http request that points to an image (*.jpg, *.png, *.gif, etc), a picture object is returned that can be assigned to the pict attribute of objects. With the exception of http requests to known image types, the source data must be textual, and if not, the resulting data will be garbled.
Some web pages and most FTP sites require user and password authentication to access. To authenticate, embed the user name and password in the URL as follows:
ReadFromUrl('http://user:password@www.site.com/dir/page.htm')
ReadFromUrl('ftp://user:password@site.com/directory/file.txt')
The optional second through fourth parameters are used to submit data to web forms. There are two methods used to submit data to HTTP web forms: method:'POST'
or method:'GET'
. The field names and the values submitted for those fields are specified in formValues
and formFields
, which must share a common index, and if that common index is anything other than form-Fields
, it should be specified in the formIndex
parameter.
For additional detailed information on specifying HTTP headers and context, and querying web services, please see ReadFromUrl.
Enable comment auto-refresher