Read data from URL on internet

Revision as of 22:31, 8 August 2017 by Max (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


The ReadFromUrl function, on the Database menu, reads text from URL sources, such as HTTP web pages or FTP sites.

This feature is available in Analytica Enterprise and Optimizer.

ReadFromUrl(url, method, formValues, formFields, formIndex)

ReadFromUrl reads text or images from a URL (Universal Resource Locator) location on the web. In most cases, ypu can call it 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://...'. It returns the entire text 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), it returns a picture object, which you can assign to the Pict attribute of objects, or into an array. 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, like this:

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 «formFields», it should be specified in the «formIndex» parameter.

See Also


Comments


You are not allowed to post comments.