QueryInfoEx

The QueryInfoEx method Returns information associated with the request, such as content-type, cookies and headers, handling multiple headers with the same name.

Syntax

QueryInfoEx(infoType, indexIn, header)

Parameters

infoType
The type of header required, see table below.
indexIn
The zero based index of the header required,
header
The string value of the header. Note you must initialize this to a variant string before you use this function (in VBScript the assignment value = "" is sufficient).
Return Values

The zero based index of the next header available. Less than zero if failure or no more headers. Special value of -5 indicates there are no headers of this type at all.

Information Type

Can be one of

HTTP_QUERY_MIME_VERSION = 0
HTTP_QUERY_CONTENT_TYPE = 1
HTTP_QUERY_CONTENT_TRANSFER_ENCODING = 2
HTTP_QUERY_CONTENT_ID = 3
HTTP_QUERY_CONTENT_DESCRIPTION = 4
HTTP_QUERY_CONTENT_LENGTH = 5
HTTP_QUERY_CONTENT_LANGUAGE = 6
HTTP_QUERY_ALLOW = 7
HTTP_QUERY_PUBLIC = 8
HTTP_QUERY_DATE = 9
HTTP_QUERY_EXPIRES = 10
HTTP_QUERY_LAST_MODIFIED = 11
HTTP_QUERY_MESSAGE_ID = 12
HTTP_QUERY_URI = 13
HTTP_QUERY_DERIVED_FROM = 14
HTTP_QUERY_COST = 15
HTTP_QUERY_LINK = 16
HTTP_QUERY_PRAGMA = 17
HTTP_QUERY_VERSION = 18 '// special: part of status line
HTTP_QUERY_STATUS_CODE = 19 '// special: part of status line
HTTP_QUERY_STATUS_TEXT = 20 '// special: part of status line
HTTP_QUERY_RAW_HEADERS = 21 '// special: all headers as ASCIIZ
HTTP_QUERY_RAW_HEADERS_CRLF = 22 '// special: all headers
HTTP_QUERY_CONNECTION = 23
HTTP_QUERY_ACCEPT = 24
HTTP_QUERY_ACCEPT_CHARSET = 25
HTTP_QUERY_ACCEPT_ENCODING = 26
HTTP_QUERY_ACCEPT_LANGUAGE = 27
HTTP_QUERY_AUTHORIZATION = 28
HTTP_QUERY_CONTENT_ENCODING = 29
HTTP_QUERY_FORWARDED = 30
HTTP_QUERY_FROM = 31
HTTP_QUERY_IF_MODIFIED_SINCE = 32
HTTP_QUERY_LOCATION = 33
HTTP_QUERY_ORIG_URI = 34
HTTP_QUERY_REFERER = 35
HTTP_QUERY_RETRY_AFTER = 36
HTTP_QUERY_SERVER = 37
HTTP_QUERY_TITLE = 38
HTTP_QUERY_USER_AGENT = 39
HTTP_QUERY_WWW_AUTHENTICATE = 40
HTTP_QUERY_PROXY_AUTHENTICATE = 41
HTTP_QUERY_ACCEPT_RANGES = 42
HTTP_QUERY_SET_COOKIE = 43
HTTP_QUERY_COOKIE = 44
HTTP_QUERY_REQUEST_METHOD = 45 '// special: GET/POST etc.
HTTP_QUERY_RETURN_CODE = 901
HTTP_QUERY_VERB = 902
HTTP_QUERY_OBJECT = 903
HTTP_QUERY_FILE_URL = 904

Example

The following requests a URL and outputs the headers:


<% Set OCXHttp = Server.CreateObject("OCXHTTP.OCXHttpCtrl.1") %>

result = OCXHttp.GET("http://www.flicks.com/scripts/debug.asp")
%>
<% If  "" = result Then %>

Succesfully requested file.

<BR>
<%
value = ""
nextIndex = 0	' start value to set off the while loop

' first - are there any cookies?
nextIndex = OCXHttp.QueryInfoEx(HTTP_QUERY_SET_COOKIE, nextIndex, value)
if (-5 = nextIndex) Then
	' -5 is a special code - there are no cookies at all!
	response.Write("There are no cookies on this page")
else
nextIndex = 0	' reset
do while nextIndex >= 0
	cookieNumber = nextIndex + 1
	response.Write("Cookie number " & cookieNumber & " is ")
	nextIndex = OCXHttp.QueryInfoEx(HTTP_QUERY_SET_COOKIE, nextIndex, value)
	response.Write(value & " <BR>" )
loop

End if

%>

<% Else %>

Could not request file because: <%= result %>

<% End If %>
 
Will output something like this:
Cookie number 1 is KCOOKIE=KCOOKVALUE1; path=/a/ 
Cookie number 2 is ASPSESSIONID=XDBWJSZEKHXNPQJN; path=/scripts 

Applies To

OCXHttp ASP Component