Affiliate Marketing
Forum Search

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 11-06-08
Registered User
 
Join Date: Jun 2007
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
MortimerJazz is an unknown quantity at this point
  Using feeds in your sites

One of the merchants I'm promoting has just introduced a feed which would make things a lot easier for me when it comes to updating the site.

My problem though is that I've never really used a feed before. What do I have to do to ensure the content appears on my site? I've got a good knowledge of HTML and know the basics of PHP ... do I need to code something myself to accept the feed or is there some kind of application that I can use to do it for me (the site is pure HTML as opposed to a WP or Joomla-based template).

Thanks alot in advance for your help
__________________
PKRPoker3D.com - Bonus codes and exclusive rakeback offers
<-- My first affiliate site. Thoughts and comments more than welcome!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-06-08
tbp tbp is offline
Registered User
 
Join Date: Dec 2006
Posts: 1,916
Thanks: 0
Thanked 10 Times in 10 Posts
tbp is an unknown quantity at this point
  Re: Using feeds in your sites

In theory, getting a reliable feed should be easy, and actually parsing the feed and inserting or updating the content in a database isn't difficult with PHP either.

I`ve always found that its much harder than it seems though, and you still have to frequently manually check the data, because its the old case of Garbage in, Garbage out. Your code can work 100%, but if theres bad data in the feed its very difficult to automatically weed it out.

Technically though, its fairly simple to parse the feed data using PHP, whether its in CSV or XML format.

With CSV, you use the file commands (fopen, fread, fclose) to read in the data from the CSV file. You then use the explode command to split the feed into an array, with a line in each cell, splitting by the newline character \n. You then use foreach() to look through each cell of the array, and use explode again to split the line by the delimiter (usually a comma or pipe (|) ), which gives you an array with each field in the row. You can then either insert this into the database, or use it to update the database by referencing a piece of unique data such as the product code.

XML is even simpler really, if you have the XML extension in your version of PHP. An example which processes an Affiliate Window merchants XML feed is:

PHP Code:
<?php
$xml 
simplexml_load_file("/home/vpsnameserver/public_html/test/awProductFeed.xml");

foreach(
$xml->merch->prod as $product){
    echo 
"Name: " $product->name "<br>";
    echo 
"AW Cat ID: " $product->cat->awCatId "<br>";
    echo 
"Brand: " $product->brand "<br>";
    echo 
"AW Link: " $product->awLink "<br>";
    echo 
"Delivery Cost: " $product->delCost "<br>";
    echo 
"Price: " $product->price->search "<br>";
    echo 
"--------------------------" "<br>";
}
?>
Thats all the code you need to parse the feed and display it on screen, you just need to modify it to insert into, or update, the database.

There is software out there to take do it, such as Price Tapestry, but i`ve never used any of these so can't comment on them.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-06-08
Registered User
 
Join Date: Jun 2007
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
MortimerJazz is an unknown quantity at this point
  Re: Using feeds in your sites

Thanks for the reply tbp - and especially for the code example.

I have a quick question. If products keep changing, is it worthwhile inserting all that information into a database? Can I not just parse the data so that it shows up directly on the website? Or should it always go into a database for security reasons?

Thanks alot
__________________
PKRPoker3D.com - Bonus codes and exclusive rakeback offers
<-- My first affiliate site. Thoughts and comments more than welcome!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-06-08
Registered User
 
Join Date: Mar 2008
Location: Manchester
Posts: 10
Thanks: 0
Thanked 1 Time in 1 Post
JonDeals is an unknown quantity at this point
  Re: Using feeds in your sites

Just a quick tip if you're using CSV files; it's easier to use the fgetcsv function rather than parsing lines into arrays yourself manually with explode.

In answer to your question, yes you should put the data into a database at set intervals (once a day or however often you need to update it). The server overhead of parsing large csv/xml files makes it prohibitive to do this on the fly for each page request.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-06-08
Registered User
 
Join Date: Jun 2007
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
MortimerJazz is an unknown quantity at this point
  Re: Using feeds in your sites

Ah ok, that makes sense.

So what I need to do is write a script that chops the feed up into one big array (using tbp's script above) and then inserts the value of each part of the array into the correct field of a database.

Once I've done that, I'm presuming that I can set the script as a CRON job to update the database once a day.

Is that correct?
__________________
PKRPoker3D.com - Bonus codes and exclusive rakeback offers
<-- My first affiliate site. Thoughts and comments more than welcome!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 12-06-08
Registered User
 
Join Date: Jan 2008
Posts: 233
Thanks: 1
Thanked 5 Times in 4 Posts
t4xi-- is an unknown quantity at this point
  Re: Using feeds in your sites

The data should always go into a database for the reason JonDeals said above but also for many other reasons - reasons you will not even be aware of yet, until you start using the feeds in this way. e.g. you can track which products are being clicked on, the time of the day, where the visitor originated from, which items convert to sale, whether the price has changed from when you first added it etc etc..

EDIT: yes you set up a cron job to run whenever you want, once a day, twice a day, once a week, whatever you want
__________________
A gem is not polished without rubbing, nor an affiliate perfected without trials.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 12-06-08
tbp tbp is offline
Registered User
 
Join Date: Dec 2006
Posts: 1,916
Thanks: 0
Thanked 10 Times in 10 Posts
tbp is an unknown quantity at this point
  Re: Using feeds in your sites

Yes, you would update the database using a CRON job. Down to you how often you want to do it, some merchants products hardly change, so once every couple of days is enough.

As the others have said, its too intensive doing it on the fly, especially with large feeds. There are a lot of advantages of using a database, such as being able to narrow down to products in a certain category, only showing a page of results at a time etc. Also allows you to do your own tracking to keep track of which products take the user to the merchants site, even if the visitor doesn't by them.

When you start out, its a good idea to "quarantine" the data before you put it live on your site, so insert it into a temporary table, and then when you've scanned through it to check its ok, overwrite the live data.

Although things are improving, there are merchants out there with lousy feeds - they have characters not escaped so lines are terminated before they shoud be, invalid prices or category info, products missing etc. Although your code can work 100%, bad data going in can still cause problems, so its best to test the system for a while to iron out any bugs and cater for any oddities before you start making the system live.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting Feeds Into Sites Php/Html toneharb Widgets, Coding, AJAX, PHP - Technology & Affiliate Marketing 3 21-01-08 02:33 PM
Cashback Sites : Love Them or Hate Them or Impassive? Qui Gon Jinn Affiliate Marketing - Moderators Choice 46 15-12-07 11:33 AM
Seach Engine Optimisation FAQ [Jan2006] thetafferboy Organic Google Search Optimisation 2 09-01-06 04:11 PM
listings sites vs affiliate sites in google se listings purple The Affiliate Marketing Lounge 7 25-01-05 07:18 AM
Content sites or Commercial KelkooAffiliateManager The Affiliate Managers Hut 4 22-03-03 03:56 PM


Affiliate Marketing RSS Feeds - Contact Us - Affiliate Marketing - Archive - Privacy Statement - Top

Content Relevant URLs by vBSEO 3.2.0 RC7