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:

ACCEPT
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

ACCEPT-ENCODING
x-gzip, gzip, deflate

ACCEPT-LANGUAGE
en-us,en-gb,en;q=0.7,*;q=0.3

HOST
psacake.com

USER-AGENT
CCBot/2.0 (http://commoncrawl.org/faq/)

X-REWRITE-URL
/web/ic.asp


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

Send me One Million FREE Guaranteed Visitors