Sei sulla pagina 1di 3

<%@ Language=VBScript %>

<% Option Explicit %>


<% Response.Buffer = True %>
<%
dim i,str_url,str_raw_data,str_columns_array
dim str_Main_Category,str_SubCategory,str_Offer_ID,str_Offer_Description,str_Ext
ended_Description
dim str_Offer_Price,str_Formed_URL,str_Feed_DateTime,str_Affiliate_Code
dim str_Last_Category,str_Last_SubCategory,str_display_category
dim str_raw_data_ok
'---------------------------------------------------------------------------------------------' call function get_xml_raw to read the special deals data from the bookingwiz p
age
'---------------------------------------------------------------------------------------------STR_RAW_DATA = GET_XML_RAW("HTTP://WWW.BOOKINGDRAGON.COM/RSS/SPECIAL_DEALS_DATA.
ASP?FM_MIC=<your affiliate code>")
'---------------------------------------------------------------------------------------------'check to make sure a valid affiliate code has been specified in the statment ab
ove
'i.e. fm_mic=<affiliate code>
'---------------------------------------------------------------------------------------------IF STR_RAW_DATA = "NEED VALID AFFILIATE CODE" THEN
RESPONSE.WRITE "INVALID AFFILIATE CODE SPECIFIED"
'-------------------------------------------------'raw data is NOT ok so stop processing here
'-------------------------------------------------STR_RAW_DATA_OK = FALSE
ELSE
'----------------------------------------------------------------------------'raw data is ok so go ahead and process and display in html section
'----------------------------------------------------------------------------STR_RAW_DATA_OK = TRUE
'---------------------------------------------------------' now split the columns of data into one large array
'---------------------------------------------------------STR_COLUMNS_ARRAY = SPLIT(STR_RAW_DATA, "||")
'-----------------------------------------------------------------' now drop down to the html code and write out the results
'-----------------------------------------------------------------End If
'==================
SUB GET_COLUMN_VALUES
'==================
' NOW SET THE STRING VARIABLES TO THE CURRENT SET OF 9 COLUMNS
STR_MAIN_CATEGORY = STR_COLUMNS_ARRAY(I) ' MAIN CATEGORY

STR_SUBCATEGORY = STR_COLUMNS_ARRAY(I+1) ' SUBCATEGORY


STR_OFFER_ID = STR_COLUMNS_ARRAY(I+2) ' OFFER ID
STR_OFFER_DESCRIPTION = STR_COLUMNS_ARRAY(I+3) ' OFFER DESCRIPTION
STR_EXTENDED_DESCRIPTION = STR_COLUMNS_ARRAY(I+4) ' EXTENDED DESCRIPTION
STR_OFFER_PRICE = STR_COLUMNS_ARRAY(I+5) ' OFFER PRICE
STR_FORMED_URL = STR_COLUMNS_ARRAY(I+6) ' BOOKINGWIZ FORMED URL
STR_FEED_DATETIME = STR_COLUMNS_ARRAY(I+7) ' FEED DATETIME
STR_AFFILIATE_CODE = STR_COLUMNS_ARRAY(I+8) ' AFFILIATE CODE
END SUB
'=======================
FUNCTION GET_XML_RAW(STR_URL)
'=======================
' USING THE MSXML SERVER OBJECT READ THE BOOKINGWIZ WEBPAGE AND SCRAPE THE
' SPECIAL DEALS DATA
DIM MYXML,XMLHTTP,XMLRESPONSE,OBJLST,STR_LOGON
SET XMLHTTP = SERVER.CREATEOBJECT("MSXML2.XMLHTTP.4.0")
XMLHTTP.OPEN "GET", STR_URL
XMLHTTP.SEND()
MYXML = XMLHTTP.RESPONSETEXT
SET XMLHTTP = NOTHING
GET_XML_RAW = MYXML
END FUNCTION
'------------------------------------------------------------------------------' raw data is valid so go ahead and show html code
' MODIFY THE CODE BELOW TO FIT YOUR NEEDS
'------------------------------------------------------------------------------If str_raw_data_ok = true Then
%>
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-LANGUAGE" CONTENT="EN-US">
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=WINDOWS-1252">
<TITLE>BOOKINGWIZ SPECIAL DEALS EXAMPLE</TITLE>
</HEAD>
<BODY>
<DIV ALIGN="CENTER">
<TABLE BORDER="0" WIDTH="700" CELLPADDING="0" CELLPADDING="0" STYLE="BORDER-COLL
APSE: COLLAPSE">
<%
' now loop thru the array and retrieve the 9 columns comprising one special deal
FOR I = 0 TO UBOUND(STR_COLUMNS_ARRAY) - 1 STEP 9
' now call the subroutine to set the string variables with the current 9 column
values
GET_COLUMN_VALUES
' now see if Category or SubCategory has changed
IF STR_MAIN_CATEGORY <> STR_LAST_CATEGORY OR STR_SUBCATEGORY <> STR_LAST_SUBCATE
GORY THEN
' now set display string to Category
STR_DISPLAY_CATEGORY = STR_MAIN_CATEGORY
' check to see if there is a SubCategory
IF LEN(STR_SUBCATEGORY) > 0 THEN

' add the SubCategory to the display


STR_DISPLAY_CATEGORY = STR_DISPLAY_CATEGORY & ": " & STR_SUBCATEGORY
END IF
' now remember the last Category and SubCategory values
STR_LAST_CATEGORY = STR_MAIN_CATEGORY
STR_LAST_SUBCATEGORY = STR_SUBCATEGORY
' now write out a new row and show the new display category/subcategory
' followed by a row with the next special deal as text link
%>
<TR>
<TD>
<BR><B><%=STR_DISPLAY_CATEGORY%></B>
</TD>
</TR>
<TR>
<TD>
<A HREF="<%=STR_FORMED_URL%>"><%=STR_OFFER_DESCRIPTION%></A>
</TD>
</TR>
<%
' no change in category so write out the special deal as text link
ELSE
%>
<TR>
<TD>
<A HREF="<%=STR_FORMED_URL%>"><%=STR_OFFER_DESCRIPTION%></A>
</TD>
</TR>
<%
END IF
NEXT
%>
</TABLE>
</DIV>
</BODY>
</HTML>
<%END IF%>