Jump Start Scripts for Creating Feeds

 
Summary

In order to automate your syndication, you must be able to write queries against your database and create executable scripts on your website. There are 3 steps to creating an automated feed:

  1. Determine the correct "Connection String" for your database.
  2. Create a query to retrieve the listings from your database
  3. Write the listings to a web page in XML format.

Step 1 - Determine the Correct Connection String.

There are many different databases as well as versions and setup configurations to go along with them. Some of the most commonly used strings are below. Please check with your web administrator if you are not sure which one in appropriate for you.

ConnectionStrings.com is also an excellent resource to check if the ones below do not work for you.

Database Connection String
MySQL Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
SQL Server 2008 Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
SQL Server 2005 Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
SQL Server 2000 Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
MS Access 2007 Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Persist Security Info=False;
MS Access (Other) Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;
All Others Please see ConnectionStrings.com

Step 2 - Create a Database Query

The sample scripts are designed to create the xml based upon the field names identified in the query. It is VERY IMPORTANT that your fields are mapped correctly, otherwise your feed may fail. Propper mapping is accomplished by using alliases in your query. For example . . .

 "Select PropertyID AS ListingID, FirstName + ' ' + LastName as AgentName, ...."

will output the field PropertyID as "ListingID", and the first and last names combined to form "AgentName".  Be sure to use any Casts, Converts, table joins, etc that will format your data to conforms with our Feed Technical Specs.

Below is an example of a SQL Server query(with 2 joined tables) that you can use as a starting point for creating your own. Please don't forget to include a "WHERE clause" in your query to filter out any listings that are no longer for sale or should not be syndicated!  

View Sample Query

Step 3 - Choose and Modify your Script.

Below are scripts for common web platforms. You web platform can be identified by the extension found in the URL Address of your web pages". Select the script that best fits your situation.

Types of Web Pages
.PHP
Pearl  
.ASP
Active Server Page Also called "Classic ASP"
.ASPX .NET (ie "Dot Net") Replacment for ASP. Can be coded in VB or C#
JSP Java Server Pages  
CFM Cold Fusion  
.HTM or .HTML Basic HTML Unlike the others, html is not a "Server Side Technology" and is designed for displaying "Static Content" that does not change. Check to see if your pages are already being hosted on one of the other technologies.
 
Sample Scripts(opens in a new window)
Pearl(PHP) with MySQL Database (.php)
ASP.Net / C# using ADO (.aspx)
ASP.net / VB using ADO
ASP.Net / VB and SQLDataAdapter for SQL Server (.aspx)
Classic ASP (.asp)
 

Additional Notes

  • Content-Type = "text/xml" Header Tag - Adding this tag to the top of your web page instructs the browser to display your information as "beautifully formatted" xml. The down side is that it can cause the page to load very slowly when displaying a large number of records. You may want to consider commenting out this command once testing and debugging is completed.
 
 
   
  Listing Syndication Overview  |   About Us  |   Analytics for ROI  |   Feed Starter Scripts  |   Contact Us  |   Frequently Asked Questions  |   How To Create a Feed  |   Feed Requirements and Specifications  |   Services and Pricing  |   Syndicate by File Upload  |   Syndication Partners and Networks  |   Free Feed Validation  |   Receive feeds from your customers  |   Send Us Your Listings  |  
Share Us!!  Share/Bookmark
version: 03112012