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?



Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.