Recently I’ve been trying to figure out a way to aggregate eBay auctions for use in one of my real estate websites. I wanted to do this for two reasons, one being to generate fresh content and the other for trying to inject my Commission Junction affiliate code into the listings.
The solution came from incorporating two already really popular tools, lastRSS and Exec-PHP. However I was hitting brick walls getting this stuff to work together. Finally my buddy Julien pointed me in the right direction. His example sites using eBay RSS and CJ were just incredible, and the implementation of the scripts was simple…after going through about 10 back and fourth emails. So to make this an easy task for you, I’ve compiled the process of what I learned from Julien’s blog post and from our emails.
Since the main purpose of this is to generate some cash using the eBay RSS feed and CJ, you need to first go grab your CJ account (that is if you don’t already have one). After then then you can continue 🙂
- Log into you Commission Junction account and point to Account/Website Settings and then select the website you wish to tie this venture to. After selecting from the drop down, write down (or past this to notepad) the PID number. You’ll need this in order to tie your account to the eBay RSS feed.
- Download the Exec-PHP plugin for WordPress here and then Activate it in your WordPress administration panel. Exec-PHP allows you to enter PHP code within your blog postings. This is necessary in order to pull in the eBay RSS feed into your blog.
- Click Users in your WordPress admin screen and scroll to the bottom to Personal Options and un-check the Use the visual rich editor when editing. I’ve personally only been able to successfully enter PHP code within the postings when turning off the rich editor.
- Go to the eBay advanced search page in order to get your customized RSS feed.
- Enter what stuff you would like to pull back from the eBay RSS feed to use on your blog.
- Enter in the PID number that you copied from step 1.
- Click the search button to generate the desired eBay RSS feed. Scroll down to bottom of the results page and look for the RSS button. Right-click and copy the Link Location of the button. Paste this HUGE URL into notepad for later use.
- Download LastRSS and unzip it. Upload lastRSS.php to your blogs root directory on your server. Create a folder called cache and make it readable and writeable (chmod 777).
- Create a new page or posting in WordPress and title it anything you’d like. For the actual post, enter the following code (keeping in mind that the BIG RED BOLD TEXT that reads ENTER THAT BIG eBAY RSS URL should be replaced with the URL you had already copied to your notepad):
<?php
include_once './lastRSS.php';
$rss = new lastRSS;
$rss->cache_dir = './cache'; $rss->cache_time = 3600; // one hour
if ($rs = $rss->get('ENTER THAT BIG eBAY RSS URL'))
{
foreach ($rs['items'] as $item) {
$rsscount++; if ($rsscount< 6) {
$myvar = $item[description];
$title = $item[title];
echo "<b>$title</b>$myvar"
}}
if ($rs['items_count'] <= 0) { echo "Sorry, no items found.<br /><br />" } } else { die ('Error: RSS file not found...'); }
?> -
Go ahead and post the article and you should see the results. *note: Some webhosting places have fopen(); turned off for “security” reasons. If this condition exists for you then chances are this thing will not work for you.
There you go. I’ve set up this on a few of my sites:
- http://www.buffalochicken.com <-thought it was a good place to pull in some hot sauce related buy-now deals.
- http://www.your-timeshare.com <- this one is pulling in Yahoo news items AND eBay RSS auction feeds.
If you have any questions please feel free to contact me, either through comments or the contact page.
As a warning, for the sake of keeping content genuine, this technique should not be used to replace humanly authored content. Doing so would indeed reduce the quality of “blogtent” on the Internet…which is the last thing we need these days.
Very cool that you put this tutorial up. I tried it out and got it working pretty quick. But then something weird happened. The next day it stopped working. And I can’t figure out why. It seems the lastRSS parser is now not stripping out the CDATA tags and I don’t know why. Any idea if something change somewhere?
Never mind. I found the problem. Operator error of course. While I was tweaking things around I changed the CDATA variable back to ‘nochange’ so it wasn’t stripping the tag off. Working now.
Thanks again for this post. Very useful.
I would like to see a continuation of the topic
Trying to run this on my local server and i get a syntax error. C:\wamp\www\wordpress\wp-content\plugins\exec-php\includes\runtime.php(41) : eval()’d code on line 2
Am i missing something obvious? I’m definitely not a coder but i’m pretty sure i’ve followed your directions correctly.
I get an error:
Parse error: syntax error, unexpected ‘/’ in /home/clickarc/public_html/wp-content/plugins/exec-php/includes/runtime.php(41) : eval()’d code on line 2
I don’t know hardly a thing about PHP (backyard-hack Perl coder only), but there are a couple of errors in the supplied code… and I got it to work. Here’s what I have:
cache_dir = ‘./cache’; $rss->cache_time = 3600; // one hour
if ($rs = $rss->get(‘THIS IS YOUR RSS CODE’))
{
foreach ($rs[‘items’] as $item) {
$rsscount++;
if ($rsscount< 6) {
$myvar = $item[description];
$title = $item[title];
echo “$title$myvar”;
}
}
}
?>
It was missing a } at the end and a semi-colon on the echo statement.
You’ll also have to play around with it to get it to display like you want it to… but as of today (Feb 2009), this still works.
Ah – can’t edit my comment. Actually, I’m not sure if it was missing the curvy bracket ‘}’ — I removed the if / else thing at the end…
I’ve been looking for a similar plugin for ages. Let me share what i’ve found: http://perishablepress.com/press/2009/04/26/import-and-display-rss-feeds-in-wordpress/
(bit long url)
let me know if it works for you!
oh that rocks Dan! Thanks for sharing!
Hi Tony,
Good post, plugin Dan posted works well too.
If you had a load of these setup and you didn’t already do it you will also need to change the rss urls to the new format ones. Check out my post on transforming them!
http://blog.woodylabs.com/2011/06/ebay-partner-network-changes-rss-urls-again/
Catcha dude.
W