Get Headers Function   
 
GetHeaders returns all headers sent to the current web page by a given user's browser.

GetHeaders returns a reference to a Scripting.Dictionary object.
The Keys and Items collections will be filled with all header name, value combinations sent by the browser.

Syntax: Set object = GetHeaders()

Example Usage:
        <%
            '--------------------------------------------------------------
            'get all headers
            '--------------------------------------------------------------
            Dim oHeaders, key

            Set oHeaders = GetHeaders
            For Each key in oHeaders.Keys
                Response.write key & "<BR>"
                Response.Write oHeaders.Item(key) & "<BR><BR>"
            Next
            Set oHeaders = Nothing


            '--------------------------------------------------------------
            'get the user agent of the browser.
            '--------------------------------------------------------------
            Set oHeaders = GetHeaders
            key = oHeaders.Item("user-agent")
            Set oHeaders = Nothing
        %>

Source Code:
<%
Private Function GetHeaders()
    dim item, d, sKey, sItem

    set d = createobject("Scripting.Dictionary")
    d.RemoveAll

    for each item in request.servervariables
        if left(ucase(item), 5) = "HTTP_" then
            sKey = replace(right(UCASE(item), len(item) - 5), "_", "-")
            sItem = request.servervariables(item)
            if not d.Exists(sKey) then d.Add sKey, sItem     
        end if
    next

    Set GetHeaders = d
End Function
%>

The Result:

CACHE-CONTROL
no-cache

CONNECTION
Keep-Alive

PRAGMA
no-cache

CONTENT-LENGTH
0

ACCEPT
Accept: application/xhtml+xml,text/html;q=0.9,text/plain;

ACCEPT-CHARSET
ISO-8859-1,utf-8;q=0.7,*;q=0.7

ACCEPT-ENCODING
gzip

ACCEPT-LANGUAGE
en-us,en;q=0.5

HOST
www.psacake.com

USER-AGENT
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)

WL-PROXY-CLIENT-IP
38.103.63.59

PROXY-CLIENT-IP
38.103.63.59

X-FORWARDED-FOR
38.103.63.59

WL-PROXY-CLIENT-KEYSIZE


WL-PROXY-CLIENT-SECRETKEYSIZE


X-WEBLOGIC-KEEPALIVESECS
30

X-WEBLOGIC-FORCE-JVMID
unset

WL-PROXY-SSL
false

X-REWRITE-URL
/web/ic.asp


My3C's
perrychicker
It's easy... it's a PSACAKE!
Back | Tell A Friend | Search this Site
© 1998 - 2008 psacake.com
Version 3.23

Send me One Million FREE Guaranteed Visitors