You can programmatically perform a web service call to your favorite web service provider to retrieve information such as weather, stock prices, or whatever data you may need. This is only available through script and only available on the versions of DAQFactory that support networking. The command is simply:
HTTP.Get(URL, Path, [Port = 80], [AdditionalHeaders = ""], [Secure = 0], [GetHeaders = 0], [binary = 0])
URL is the url for the server, such as "www.azeotech.com". It does not include the path. Path is the path to the desired file on the server, say "/index.html". For example, to retrieve the weather for Winnecmucca, NV you would do something like:
global string datain
datain = HTTP.Get("www.weather.gov", "/xml/current_obs/KWMC.xml")
At this point, DAQFactory does not have an XML parser, so you will need to parse the response yourself. We have included a sample, HTTPGet.ctl in the samples folder that shows a simple XML parser in script to parse some of the weather data from weather.gov.
The other parameters are optional.
Port is the desired port to connect to on the server. HTTP is typically at port 80, while HTTPS is typically at port 443.
AdditionalHeaders is a string that is added to the headers sent to the server. This could be login information for a website with basic HTTP login.
Secure = 1 will cause the request to be done over SSL. Typically you will want to specify a port of 443 as well.
GetHeaders = 1 will cause the request to only return the headers and not the content. There are some server requests that require a GetHeaders to retrieve information about the main response before the main response is requested.
Binary = 1 will cause the request to treat the response as binary. In the default text mode, the response is treated as text and CRLF's are added to the response in appropriate spots. In binary mode, nothing is added and the response is returned raw.