|
|
|
Services & Products |
| PARTNER SITES |
| |
|
We recommend these web sites: * If you would like to link to us, please email me!
<%
Dim SiteKey
Dim CurrentPage
Dim PostingString
Dim PassedQuery
Dim ErrorString
Dim ResultString
Dim Category
' ------------------------------------------------------------------------------------------------
' The SiteKey below is set automatically when you grab the install code and should not be altered.
' ------------------------------------------------------------------------------------------------
SiteKey = "V2UZ9L9Y6X"
' ------------------------------------------------------------------------------------------------
' This sets the parameter string sent to the EZLinkSystem server
' ------------------------------------------------------------------------------------------------
CurrentPage = Request.ServerVariables("SCRIPT_NAME")
PostingString = "&Site=" & SiteKey
PostingString = PostingString & "&ScriptLocation=" & CurrentPage
' ------------------------------------------------------------------------------------------------
' This sets up the Category to be displayed in the title of the page.
' ------------------------------------------------------------------------------------------------
PassedQuery = Request.QueryString
If Len(Request.QueryString("category_page")) > 0 Then
Category = Left(Request.QueryString("category_page"),InStr(Request.QueryString("category_page"),"[")-1)
End If
' ------------------------------------------------------------------------------------------------
' Now the functions that actually go and get the links data to display.
' ------------------------------------------------------------------------------------------------
Function GetLinksData(strQuery, strPost, ByRef strResponse, ByRef strError)
Dim httpObject
Dim ComponentString
' ----------------------------------------------------------------------
' General procedure:
' 1. Create the http object.
' 2. Set the query/post string and send it to the EZLinkSystem server.
' 3. Return either the links data page, or an error.
' ----------------------------------------------------------------------
' ------------------------------------------------------------------
' 1. First, setup the actual http object that will do the http connect.
' ------------------------------------------------------------------
Set httpObject = Nothing
On Error Resume Next
Set httpObject = CreateObject("WinHttp.WinHttpRequest.5.1")
ComponentString = "" & vbCrLf
On Error Resume Next
If httpObject Is Nothing Then
Set httpObject = CreateObject("WinHttp.WinHttpRequest.5")
ComponentString = "" & vbCrLf
End If
On Error Resume Next
If httpObject Is Nothing Then
' --------------------------------------------------------------------------------------------------
' If we get here, it means the winHttp object was not able to be created so we have to try something
' a little different ( name, using the Microsoft XML http routines).
' --------------------------------------------------------------------------------------------------
If GetLinksDataViaMSXML(strQuery, strPost, strResponse, strError) Then
GetLinksData = True
Else
GetLinksData= False
End If
Else
' -----------------------------------------------------------------
' 2. Setup the parameters, and make the connection to EZLinkSystem.com
' -----------------------------------------------------------------
httpObject.Open "GET", "http://www.EZLinkSystem.com/linkpage.php?" & strQuery & strPost, False
httpObject.Send
' -----------------------------------------------------------------
' 3. If we don't get a 200 OK response, then there is a critical error
' -----------------------------------------------------------------
If httpObject.Status <> 200 Then
strError = "Critical Error: Status=" & httpObject.Status & " Error Text=" & httpObject.ResponseText
GetLinksData= False
Else
' -------------------------------------------------
' SUCCESS!! We have the links data to display now.
' -------------------------------------------------
strResponse = ComponentString & httpObject.responseText
GetLinksData= True
End If
End If
End Function
' ---------------------------------------------------------------------------------------
' This function only gets called if the winHttp object cannot be created and initialized.
' ---------------------------------------------------------------------------------------
Function GetLinksDataViaMSXML(strQuery, strPost, ByRef strResponse, ByRef strError)
Dim httpObject
Set httpObject = Nothing
' ----------------------------------------------------------------------
' General procedure:
' 1. Create the http object.
' 2. Set the query/post string and send it to the EZLinkSystem server.
' 3. Return either the links data page, or an error.
' ----------------------------------------------------------------------
' ----------------------------
' 1. Create the http object.
' ----------------------------
On Error Resume Next
Set httpObject = CreateObject("Msxml2.ServerXMLHTTP")
ComponentString = "" & vbCrLf
On Error Resume Next
If httpObject Is Nothing Then
Set httpObject = CreateObject("Msxml2.ServerXMLHTTP.4.0")
ComponentString = "" & vbCrLf
End If
On Error Resume Next
If httpObject Is Nothing Then
Set httpObject = CreateObject("Microsoft.XMLHTTP")
ComponentString = "" & vbCrLf
End If
On Error Resume Next
If httpObject Is Nothing Then
' ----------------------------------------------------------------------------
' If we see this error, then under no method in either function could we
' contact EZLinkSystem.com . You should contact your system adminstrator
' in this case.
' ----------------------------------------------------------------------------
strError = "No ASP support for HTTP requests. Links page cannot be retrieved."
GetLinksDataViaMSXML = False
Else
' ----------------------------------------------------------------------------
' 2. Set the query/post string and send it to the EZLinkSystem server.
' ----------------------------------------------------------------------------
httpObject.open "GET", "http://www.EZLinkSystem.com/linkpage.php?" & strQuery & strPost, false
httpObject.Send
' ----------------------------------------------------
' 3. Return either the links data page, or an error.
' ----------------------------------------------------
If httpObject.status <> 200 Then
' ------------------------------------------------------------
' An error has occured related to contacting EZLinkSystem.com.
' ------------------------------------------------------------
strError = "Critical Error: Status=" & httpObject.status & " Error Text='" & httpObject.responseText & "'"
GetLinksDataViaMSXML = False
Else
' ------------------------------------------------
' We have successfully gotten the links page data.
' ------------------------------------------------
strResponse = ComponentString & httpObject.responseText
GetLinksDataViaMSXML = True
End If
Set httpObject = Nothing
End If
End Function
%>
|