Artikel |
Beschreibung |
Dauer |
Preis |
Endet |
";
// Build the ebay url
$URL = "http://cgi6.ebay.de/ws/eBayISAPI.dll?MfcISAPICommand=ViewListedItems&userid=$ebayid&since=$since&sort=$sort&rows=0";
// Where to Start grabbing and where to End grabbing
$Start = "Zum Sortieren klicken Sie auf die Spaltenüberschriften";
$GrabEnd = "";
// Open the file
$file = fopen("$URL", "r");
// Read the file
if (!function_exists('file_get_contents')) {
$r = fread($file, 80000);
}
else {
$r = file_get_contents($URL);
}
// Grab just the contents we want
$stuff = eregi("$Start(.*)$GrabEnd", $r, $content);
// Get rid of some rubbish we don't need.
// And set things up to be split into lines and items.
$content[1] = ereg_replace("","",$content[1]);
$content[1] = ereg_replace(".*Höchstbietender\/Status","",$content[1]);
$content[1] = ereg_replace(" .*Höchstbietender\/Status","",$content[1]);
$content[1] = str_replace(" ", "", $content[1]);
$content[1] = str_replace("", "", $content[1]);
$content[1] = str_replace("\r\n", "", $content[1]);
$content[1] = str_replace("\n", "", $content[1]);
$content[1] = str_replace("\r", "", $content[1]);
$content[1] = str_replace("", "", $content[1]);
$content[1] = str_replace(" | ", "", $content[1]);
$content[1] = str_replace(" | ", "", $content[1]);
$content[1] = str_replace("", "", $content[1]);
$content[1] = str_replace("", "", $content[1]);
$content[1] = str_replace(" | ", "", $content[1]);
$content[1] = str_replace(" ", "", $content[1]);
$content[1] = str_replace(" ", "", $content[1]);
$content[1] = str_replace("", "[ITEMS]", $content[1]);
$content[1] = str_replace(" ", "[LINES]\n", $content[1]);
/* freed: 02.09.2004 */
$content[1] = str_replace("", "", $content[1]);
// Line used during debug
// echo " $content[1] ";
// Close the file
fclose($file);
$stuff = $content[1];
// Build our first array for EOF
$items = explode("[LINES]",$stuff);
// Loop through our lines
$count = "0";
foreach ($items as $listing) {
// Break apart each line into individual items
list($Item,$Start,$End,$Price,$Title,$HighBidder ) = explode("[ITEMS]",$listing);
//Use a countdown to get Time Left
//We first need to break apart End and convert the months to numbers
$seperate = split('[. :]', $End);
// $seperate[0] = str_replace("Jan", "1", $seperate[0]);
// $seperate[0] = str_replace("Feb", "2", $seperate[0]);
// $seperate[0] = str_replace("Mar", "3", $seperate[0]);
// $seperate[0] = str_replace("Apr", "4", $seperate[0]);
// $seperate[0] = str_replace("May", "5", $seperate[0]);
// $seperate[0] = str_replace("Jun", "6", $seperate[0]);
// $seperate[0] = str_replace("Jul", "7", $seperate[0]);
// $seperate[0] = str_replace("Aug", "8", $seperate[0]);
// $seperate[0] = str_replace("Sep", "9", $seperate[0]);
// $seperate[0] = str_replace("Oct", "10", $seperate[0]);
// $seperate[0] = str_replace("Nov", "11", $seperate[0]);
// $seperate[0] = str_replace("Dec", "12", $seperate[0]);
$day = $seperate[0];
$month = $seperate[1];
$year = $seperate[2];
$hour = $seperate[3]+$timezone;
$minute = $seperate[4];
$second = $seperate[5];
// mktime is the marked time, and time() is the current time.
$target = mktime($hour,$minute,$second,$month,$day,$year);
$diff = $target - time();
$days = ($diff - ($diff % 86400)) / 86400;
$diff = $diff - ($days * 86400);
$hours = ($diff - ($diff % 3600)) / 3600;
$diff = $diff - ($hours * 3600);
$minutes = ($diff - ($diff % 60)) / 60;
$diff = $diff - ($minutes * 60);
$seconds = ($diff - ($diff % 1)) / 1;
// next we put it into a presentable format
$Time_Left = $days . "Tage" . " " . $hours . "Std" . " " . $minutes . "Min";
// and last we want to print auction ended when the auction has ended
if ($seconds < 0) {
$TimeLeft = "Auktion beendet";
}
else {
$TimeLeft = $Time_Left;
}
// Make sure we have content to print out and print it
if ($Start && $End && strip_tags($Price) && $Title && ($count < $limit)) {
$count++;
$colour = ( $colour == "$table_row1_color" ) ? "$table_row2_color" : "$table_row1_color";
$line = " | $Item | $Start | $End | $TimeLeft | $Price | $Title | $HighBidder | \n";
preg_match('/item=([^'&]*)/', $line, $match);
$itemnum=$match[1];
preg_match('/category=([^'&]*)/', $line, $match);
$catnum=$match[1];
if ($newwindow == 1) {
$tnURL = " ";
$Item = str_replace("a href=", "a target=\"_blank\" href=", $Item);
$HighBidder = str_replace("a href=", "a target=\"_blank\" href=", $HighBidder);
}
else {
$tnURL = " ";
}
// If Thumbnails are enabled show them
if ($thumbs == 1) {
echo "
$tnURL$Item | $Title | $TimeLeft | $Price | $End | \n";
}
// Otherwise just show the Bid Now link
else {
echo "$Item | $Title | $TimeLeft | $Price | $End | \n";
}
}
}
// Wrap up the border table
echo " |