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)
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:
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: '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.
- Links or URL in model attributes
- Retrieving Content From the Web
- Excel spreadsheets read and write
- Read and write text files