    #ifndef __snc_utility_bi__
    #define __snc_utility_bi__

    const as string LINEEND   = chr(13,10)
    const as string HEADEREND = chr(13,10,13,10)

    const as string MIME_HTM = "text/html"
    const as string MIME_TXT = "text/plain"

    const as string MIME_BMP = "image/bmp"
    const as string MIME_GIF = "image/gif"
    const as string MIME_JPG = "image/jpeg"
    const as string MIME_PNG = "image/png"
    const as string MIME_TIF = "image/tiff"

    const as string MIME_WAV = "audio/wav"
    const as string MIME_MP3 = "audio/mpeg"
    const as string MIME_OGG = "audio/ogg"

    const as string MIME_PDF = "application/pdf"
    const as string MIME_ZIP = "application/x-compressed"
    const as string MIME_GZ  = "application/gzip"
    ' ...

    ' url en/de-coding
    function URLEncode(url as string) as string
      static as string * 63 an = "abcdefghijklmnopqrstuvwxyz" & _
                                 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" & _
                                 "0123456789/"
      url=trim(url)
      dim as integer nChars = len(url)
      if nChars<1 then return ""
      dim as string encoded
      for i as integer = 1 to nChars
        dim as string char = mid(url,i,1)
        if instr(an,char)>0 then
          encoded &= char
        else
          encoded &= "%" & lcase(hex(asc(char),2))
        end if
      next
      return encoded
    end function

    function URLDecode(url as string) as string
      url=trim(url)
      dim as integer nChars = len(url)+1
      if nChars<2 then return ""
      dim as string decoded
      dim as integer i=1
      while i<nChars
        dim as string char = mid(url,i,1)
        if char="%" then
          decoded &= chr(val("&H" & mid(url,i+1,2))):i+=3
        else
          decoded &= char : i+=1
        end if
      wend
      return decoded
    end function

    ' build an HTTP GET request: e.g. ("domain.com", "/test.txt", "text/plain")
    function HTTPGet(byref host as string, byref pathfile as string, byval mime as string="") as string
      dim as string msg
      msg  = "GET "   & pathfile & " HTTP/1.1" & LINEEND
      msg &= "Host: " & host     & LINEEND
      if len(mime)>0 then
      msg &= "mime: " & mime     & LINEEND
      end if
      msg &= LINEEND
      return msg
    end function

    ' build an HTTP HEAD request: e.g. ("domain.com", "/test.jpg", "image/jpg")
    function HTTPHead(byref host as string, byref pathfile as string, byval mime as string="") as string
      dim as string msg
      msg  = "HEAD "  & pathfile & " HTTP/1.1" & LINEEND
      msg &= "Host: " & host     & LINEEND
      if len(mime)>0 then
      msg &= "mime: " & mime     & LINEEND
      end if
      msg &= LINEEND
      return msg
    end function

    ' build an HTTP POST request: e.g. ("domain.com", "/script.php", "key1=value&key2=value")
    function HTTPPost(byref host as string, byref pathfile as string, byref query as string, byref UseReferer as integer=1) as string
      dim as string msg
      msg  = "POST "  & pathfile & " HTTP/1.1" & LINEEND
      msg &= "Host: " & host     & LINEEND
      if UseReferer then
        msg &= "Referer: http://" & host & pathfile & "?" & LINEEND
      end if
      msg &= "Content-type: application/x-www-form-urlencoded" & LINEEND
      msg &= "Content-length: " & len(query) & LINEEND
      msg &= "Connection: close" & HEADEREND
      msg &= query
      return msg
    end function
    #endif ' __snc_utility_bi__