The Auction Software Review
Free Membership
* Receive software news
* Get exclusive discounts
* Post in the forum
Already a member? Login
eSellerPro
ChannelAdvisor
Sellernet
Vendio
Linnworks Order Management
RainWorx Online
Auction Software

RainWorx Auction Software
Create your own Online Auction Website!
Plus Reverse, RFQ, Classifieds, Trades, & MORE
Sales Configurator
Reduce costs, speed
up the sales cycle, and
increase order accuracy.
 
 

Contents

Instructions

Create an ASP page, inserting the ASP code below at the very start of the page. You will need to create a database table to hold the results (see below) and enter a valid connection string in the variable indicated.

Insert the HTML code below between the <body> tags of your ASP page. To use the page run a search as normal, then paste the source code into the large box on the page and click submit.

Use the SQL code to create queries in your database which aggregate the data you have extracted.

Please note the following:

  • No warranties or guarantees are offered for this code. It has been tested and used by us, but your system settings, eBay changes, and other factors may stop it working for you.
  • You use this code at your own risk. We are not responsible for any damage or complaint arising from its use.
  • You may freely use and adapt this code for any purpose, as you see fit. Please credit this site if you do so.

ASP Code


  <%
  
  'First you will need a database table with the structure below,
  'or equivalent
  '***********************************************************
  'CREATE TABLE [tblEbayItems] (
  '[ItemID] [int] IDENTITY (1, 1) NOT NULL ,
  '[TopCatID] [int] NOT NULL ,
  '[eBayItemID] [nchar] (10) NOT NULL ,
  '[ItemTitle] [nvarchar] (50) NOT NULL ,
  '[Price] [money] NOT NULL ,
  '[Bids] [smallint] NOT NULL)
  
  Dim strResponse, Match, Matches, strOutPut, intCategory
  Dim intItemCount, x, strSQL, con, strDBConnection, reItem
  Dim intMaxItems

  'Set the variable strDBConnection to connect to your database
  '***********************************************************
  strDBConnection = "ENTER YOUR CONNECTION STRING HERE"

  'Check if the form has been submitted
  '***********************************************************
  If Request.Form <> "" Then

    'Gather the data submitted in the form
    '*********************************************************
    intCategory = CLng(Request.Form("cat"))
    strResponse = Request.Form("text")
    intMaxItems = CInt( "0" & Request.Form("max"))
    If intMaxItems = 0 Then intMaxItems = 100
        
    'Set up regular expression object
    'The reItem object matches the item data embedded in 
    'JavaScript in the search results page
    '
    'The following place holders are used:
    '$1 = Number of bids
    '$2 = eBay Item Number
    '$3 = Item Name
    '$4 = Price
    '
    'Note that this regular expression sometimes misses data
    'so check the "Items Retrieved" number after parsing
    '*********************************************************
    Set reItem = New RegExp
    reItem.Global = True
    reItem.IgnoreCase = True
    reItem.Pattern = "dSI\([01]\,[01]\,[01]\,[01]\,[01]\," & _ 
      "[01]\,[01]\,[01]\,[01]\,[01]\,[01]\,(\d{1,3})\,(\d" & _
      "{10})\,""([^""]{1,50})[^\$]*\$([\d\.]*)"
    
    'Initialise the database connection
    '*********************************************************
    Set con = Server.CreateObject("ADODB.Connection")
    con.Open strDBConnection
  
    'Uncomment the next two lines below to clear the database
    'table before adding data
    '*********************************************************
    'strSQL = "TRUNCATE TABLE tblEbayItems; "
    'con.Execute strSQL
  
    '*********************************************************
    'Execute the regular expression then iterate through the
    'resulting matches up to the maximum number of items 
    'requested
    '
    'Add the data in the placeholders to an HTML
    'table and execute a SQL query to add it to the database
    '*********************************************************
    Set Matches = reItem.Execute(strResponse)
      For Each Match in Matches
        
        strOutPut = strOutPut & reItem.Replace(Match.Value, _
          "<tr> <td>$1</td> <td>$2</td> <td>$3</td> <td>" & _
          "$4</td> </tr>" & vbNewLine)
        strSQL = reItem.Replace(Match.Value, "INSERT INTO" & _
          "tblEbayItems (TopCatID, eBayItemID, ItemTitle," & _
          " Price, Bids) VALUES (" & intCategory & ", '$2" & _
          "', '$3', $4, $1);")  
  
        con.Execute strSQL
        
        intItemCount = intItemCount + 1
        If intItemCount >= intMaxItems Then Exit For
        
      Next
      
    con.Close
    Set con = Nothing  
    
  End If	
  
  %>

HTML Code

  <form action="" method="post" name="form">
<p>Category:
<select name="cat">
<option value="20081" selected>Antiques</option>
<option value="550">Art</option>
<option value="267">Books</option>
<option value="12576">Business & Industrial</option>
<option value="11450">Clothing, Shoes & Accessories</option>
<option value="11116">Coins</option>
<option value="1">Collectibles</option>
<option value="293">Computers & Electronics</option>
<option value="237">Dolls & Bears</option>
<option value="45099">Entertainment</option>
<option value="11700">Home</option>
<option value="281">Jewelry & Watches</option>
<option value="619">Musical Instruments</option>
<option value="870">Pottery & Glass</option>
<option value="888">Sports</option>
<option value="260">Stamps</option>
<option value="220">Toys & Hobbies</option>
<option value="99">Everything Else</option>
</select> Category Number = <%=intCategory%>
</p>
<p>Max Items: <input name="max" type="text" value="<%=intMaxItems%>" size="5" maxlength="5"></p>
<p>Items Retrieved: <%=intItemCount%></p>
<p><input type="submit" name="Submit" value="Submit"></p>
<p><textarea name="text" cols="100" rows="25" wrap="virtual"> <%=strResponse%></textarea></p>
</form>
<table>
<tr>
<td>BIDS</td>
<td>EBAY NO</td>
<td>ITEM NAME</td>
<td>PRICE</td>
</tr>
<%=strOutPut%>
</table>

SQL Code

This counts the number of items which received different bid volumes from zero upwards:

   SELECT Bids, COUNT(ItemID) AS BidCount
   FROM tblEbayItems
   GROUP BY Bids
   ORDER BY Bids

Latest News

Directory Additions: Shipping and Sniping
Paypal Batch Printing prints multiple eBay invoices, shipping labels and packing slips in one batch.

ChannelAdvisor Extends Amazon Solution to Germany and France
ChannelAdvisor now supports Amazon Germany and France, including Fulfillment By Amazon (FBA).

ChannelAdvisor UK Insite Dates Announced
Dates for ChannelAdvisor's annual Insite conference have been published.

ChannelAdvisor Launches Mobile-Optimized Webstores
ChannelAdvisor has announced a new mobile version of its online store for Premium Webstore subscribers.

Vendio Launches Free Item Condition Reviser for eBay
Marketplace solutions provider Vendio has launched a free tool that revises the condition of live eBay items to comply with eBay's new item condition rules.

New Features for Tradebox Finance Manager
New features for eBay UK accounting tool Tradebox Finance Manager are due to be released in the next 6 weeks.

Prostores 10 Features New Page Builder
The latest version of eBay-owned webstore solution ProStores includes a new page designer, improved order and catalog management, and promotions automation.

View all news...