The Code
This ASP script requests your latest items for sale on Amazon and
formats them as a local web page. You'll need an Amazon developer's
token to run the script, and you can
include an affiliate tag.
You'll also need to find your Seller ID
and set it at the top of the code.
<%
' Set Associate ID, Developer Token, and Seller ID
Const AFF_TAG = "insert associate tag"
Const DEV_TOKEN = "insert developer token"
Const SELLER_ID = "insert seller ID"
XMLURL = "http://xml.amazon.com/onca/xml3" & _
"?t=" + AFF_TAG & _
"&dev-t=" + DEV_TOKEN & _
"&SellerSearch=" + SELLER_ID & _
"&type=heavy" & _
"&page=1" & _
"&offerstatus=open" & _
"&f=xml"
' Issue the request and wait for the response
Set xmlhttp = Server.CreateObject("Msxml2.SERVERXMLHTTP")
xmlhttp.Open "GET", XMLURL, false
xmlhttp.Send(Now)
If Err.Number <> 0 Then
response.write "Unable to connect to Amazon."
response.end
End If
Set XMLDoc = xmlhttp.responseXML
'response.write "<xmp>" & XMLDoc.xml & "</xmp>"
If XMLDoc.parseError.ErrorCode <> 0 Then
response.write "Error: " & XMLDoc.parseError.reason
response.end
End If
' Look for the ErrorMsg tag
Set XMLError = XMLDoc.SelectNodes("//ErrorMsg")
' If it exists, display the message and exit
If XMLError.length > 0 Then
response.write XMLDoc.SelectSingleNode("//ErrorMsg").text
response.end
End If
' If there's no error, loop through items for sale
Set ProdDetail = XMLDoc.SelectNodes("//ListingProductDetails")
For x = 0 To (ProdDetail.length - 1)
strExID = ProdDetail(x).selectSingleNode("ExchangeID").text
strTitle = ProdDetail(x).selectSingleNode("ExchangeTitle").text
strPrice = ProdDetail(x).selectSingleNode("ExchangePrice").text
strOffer = ProdDetail(x).selectSingleNode("ExchangeOfferingType").text
response.write "<b>" & strTitle & "</b><br>"
response.write strPrice & " (" & strOffer & ")"
response.write "<br><br>" & vbCrLf
Next
%>