Sign in to follow this  

Secured HTTP GET authentication

Recommended Posts

I have a device which I would like to pull XML data from with GET.  Going via a browser works fine but through DAQ is not so fortunate as it requires authentication.  With http://user/pwd@ both depriciated and considered an invalid URL I am unable to easily pull information.  Is there experience and/or examples on the forum using headers to pass authentication that would complete this task?



Share this post

Link to post
Share on other sites

The latest build of DAQFactory (but I'm not sure about the latest release) adds several options to the HTTP.Get() function.  That function now looks like:

response = HTTP.Get(URL, [remote path], [port], [extra headers], [secure], [get headers])

URL is the URL without HTTP:// and without any path, so for example ""

Path is the path on the server, and defaults to "/"

Port defaults to 80

extra headers is a string with any extra headers you want to add.  They'll need to be formatted as if they were in the actual header as I believe they are just injected into the default headers.  Windows handles this.

Secure = non-zero does an SSL connection (https://).  If 0, it is a straight HTTP connection

If [get headers] is supplied and non-zero, then response is a 2 element array.  The first element is the response content, the second element is the headers for the response.  If [get headers] is 0, or not supplied, then response is just a string with the content.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this