<%@ Language=VBScript %> <% Dim AssociatesID ' If you want $$$ Dim DevToken ' The token you received Dim Catalog ' Catalog you're searching Dim XSLURL ' Location of your XSL AssociatesID = "coinzorg-20" DevToken = "AKIAJBMLXJUS5FQWYVUQ" Catalog = request("catalog") XSLURL = "http://coinz.org/style/amazon.xsl" '-------------------------------------------------------- '--- Declare some other things we'll work with Dim keyword, Count, Page '--- Get the Page so that you can page through results! Page = request("page") if len(Page) = 0 then Page = 1 else Page = cint(Page) '--- Get the keyword and encode the URL keyword =request("keyword") '-------------------------------------------------------- ' Search Amazon Catalog function '-------------------------------------------------------- Function GetAmazon(keyword) Dim objXML, objXSL, objSrvHTTP, XMLURL '--- Create the DOM object Set objXML = CreateObject("MSXML2.DOMDocument.4.0") Set objXSL = CreateObject("MSXML2.DOMDocument.4.0") call objXML.setProperty("NewParser", True) call objXSL.setProperty("NewParser", True) objXML.async = False objXSL.async = False objXML.validateOnParse = false objXSL.validateOnParse = false '--- Now we can create the URL to call XMLURL = "http://ecs.amazonaws.com/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=" & DevToken &_ "&AssociateTag=" & AssociatesID &_ "&Operation=ItemSearch&Keywords=" & keyword &_ "&SearchIndex=" & Catalog & "&ItemPage=" & Page & "&Sort=+salesrank&f=xml" response.write XMLURL '--- OK, Load the URL set objSrvHTTP = CreateObject("MSXML2.ServerXMLHTTP.4.0") call objSrvHTTP.open ("GET",XMLURL,false) call objSrvHTTP.send () '--- This DOCTYPE was giving me trouble, so I removed it from the result stream objXML.loadxml (replace(objSrvHTTP.responseXML.xml,"","")) objXSL.load(Server.MapPath("/" & "style/amazon.xsl" )) Count = objXML.SelectNodes("ProductInfo/Details").Length GetAmazon = objXML.transformNode (objXSL) set objSrvHTTP = Nothing set objXML = Nothing set objXSL = Nothing End Function %> co][nz.org - Sandbox [Search Amazon]
This site will look MUCH better in a browser that supports web standards, but its content is accessible to any browser or Internet device.
Home > Sandbox > Search Amazon.com
<% '--- This calls the actual Function and populates our Arrays. strResults = GetAmazon(keyword) %>
<% if trim(keyword) <> "" then %>
<% if trim(strResults) <> "" then response.write strResults else%>


No more products are available matching your search criteria.

<%end if%> <%if Count < 1 or Catalog = "" or keyword = "" then%> <% else %>
<%end if%>