IS.HTTPCLIENT - Using Universe and UniData HttpCall Extensions

Universe and Unidata have built in UniBASIC extensions that make the job of calling to a HTTP web server relatively easy. If you look into the UniVerse and/or UniData BASIC extension manual, you will see references to the CallHTTP functions that were added.

These functions isolate a lot of the complexity of writing the HTTP protocols by hand, but they still require you to do some work. The subroutine included with this article removes that set of complexity by creating a single subroutine that you can call.

SUBROUTINE IS.HTTPCLIENT(HTTP.METHOD,URL,HEADER.DATA,POST.DATA,RESP.HTTP.STATUS,RESP.HEADERS,RESP.DATA,ERROR) 
  • HTTP.METHOD
    This is the HTTP Method you are asking the web server to process. Normally, this is either 'GET' or 'POST'
  • URL
    This is the "Http://" or "Https://" want to request data from or send data to.
  • HEADER.DATA<1,n>
    Http Request Header Name - This is the header name that the developer wants to included with the request to the server.
  • HEADER.DATA<2,n>
    Http request Header data - This is the data you want to include with this header name
  • POST.DATA<-1>
    This is the data you want to send to the web server. Each AM (Char(254)) will be converted to a CRLF.
  • RESP.HTTP.STATUS
    Http response returned by the web server. That values are between 100-500. Most successful request will return with a value of 200 or 201 as per the HTTP protocol.
  • RESP.HEADER<1,N>
    Header Names returned with the response data. This is provided by the web server, and may include important information.
  • RESP.HEADER<2,N>
    Value for the header data
  • RESP.DATA<n>
    This is the data returned by the web server based on the URL, HTTP.METHOD, and POST.DATA. Each CRLF will be converted into an AM mark (char(254))

Login to Read Complete Article.

Downloads:

International Spectrum

Located in Thorton CO.

View more articles

Featured:

IS.HTTPCLIENT - Using UniVerse and UniData UniBASIC Sockets

menu
menu