tacker
Threadersteller
Dabei seit: 22.03.2002
Ort: Trondheim, Norwegen
Alter: 43
Geschlecht:
|
Verfasst Do 14.09.2006 13:41
Titel Mit PEAR ebay-Auktionen auf der eigenen Homepage anzeigen |
|
|
Mit PEAR ebay-Auktionen auf der eigenen Homepage anzeigen
Code: | <?php
// +----------------------------------------------------------------------+
// | Display ebay auctions on your homepage |
// +----------------------------------------------------------------------+
// | Copyright (C) 2006 Markus Tacker <m@tacker.org> |
// +----------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the |
// | Free Software Foundation, Inc. |
// | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
// +----------------------------------------------------------------------+
// Some PEAR packages are required
// Installation is out of the scope of this script. Please refer to
// http://pear.php.net
// PEAR XML_RSS must be version >=0.9.10
require_once 'Cache/Lite.php';
require_once 'HTML/Page2.php';
// This is where you put the RSS-URL to your auctions page
// Look for the orange RSS-Icon on the bottom of the page
$rss_url = '';
// We cache the RSS-Data to speed up page generation
$cache_options = array(
'cacheDir' => './cache/', // make sure that the 'cacheDir' location is writable by the webserver
'lifeTime' => 3600, // seconds
'automaticSerialization' => true,
);
$Cache = new Cache_Lite($cache_options);
if (!$items = $Cache->get($rss_url, 'items')) {
require_once 'XML/RSS.php';
$rssdata = file_get_contents($rss_url);
$RSS = new XML_RSS($rssdata);
$RSS->parse();
$items = $RSS->getItems();
$Cache->save($items, $rss_url, 'items');
}
$HTML = new HTML_Page2();
if (!empty($items)) {
$HTML->addBodyContent('<ul>');
foreach ($items as $item) {
$HTML->addBodyContent('<li><a href="' . $item['link'] . '" target="_blank">' . $item['title'] . '</a></li>');
}
$HTML->addBodyContent('</ul>');
}
$HTML->display();
?> |
Zuletzt bearbeitet von tacker am Do 14.09.2006 13:42, insgesamt 1-mal bearbeitet
|
|