- Registriert
- 09.12.06
- Beiträge
- 417
Hi,
ich habe hier ein PHP Script, was dazu dienen soll eBay-Auktionen in einer Website anzuzeigen. Leider funktioniert es noch nicht ganz und ich bin mir nicht ganz sicher ob es am PHP Script liegt oder am Server. Deshalb Tester. Wäre einer bereit diese Script mal bei sich auf dem Server zutesten, sodass ich sagen ob es am Script oder am Server liegt? Vorausgesetzt er hat einen wo PHP drauf läuft. Bei mir auf dem Server läuft es nicht. Der Code ist hier offengelegt und unten ist er fertig inkl. HTML zum testen als download.
Anhang anzeigen ebay.zip
ich habe hier ein PHP Script, was dazu dienen soll eBay-Auktionen in einer Website anzuzeigen. Leider funktioniert es noch nicht ganz und ich bin mir nicht ganz sicher ob es am PHP Script liegt oder am Server. Deshalb Tester. Wäre einer bereit diese Script mal bei sich auf dem Server zutesten, sodass ich sagen ob es am Script oder am Server liegt? Vorausgesetzt er hat einen wo PHP drauf läuft. Bei mir auf dem Server läuft es nicht. Der Code ist hier offengelegt und unten ist er fertig inkl. HTML zum testen als download.
Code:
<?php
// Your Ebay Member Name
$ebayid = "kuechenmensch";
// Display Thumbnails?
$thumbs = "1"; // 1 = yes 0 = no
// Open Links in a new window?
$newwindow = "1"; // 1 = yes 0 = no
// Table Border Color
$table_border_color = "#FFFFFF";
// Table Header Row Color
$table_header_color = "#888888";
// Table Alt Color Row 1
$table_row1_color = "#FFFFFF";
// Table Alt Color Row 2
$table_row2_color = "#ADCEEF";
// Ebay uses Pacific time zone use this to add hours for your time zone
$timezone = "0";
// Display Ended Auctions (-1 = Current, 1 - 30 = Up to 30 Days in the past)
$since = "-1";
//Sort By (Item Number = 1, Auction Start = 2, Auction End = 3, Current Price = 4, Newest First = 8,)
$sort = "3";
// Display how many per page - Set to a very high number like 999999 for all your listings
$limit = "10";
//-----------------------------------------------------------------
// Nothing Below Here needs editing.
// Start our border table
echo "
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">
<tr><td bgcolor=\"$table_border_color\"><table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">
<tr>
<td bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Artikel</strong></font></td>
<td width=\"100%\" bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Beschreibung</strong></font></td>
<td bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Dauer</strong></font></td>
<td bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Preis</strong></font></td>
<td bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Endet</strong></font></td>
</tr>
";
// 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("</a><table border=\"1\" cellpadding=\"3\".*</td></tr>","",$content[1]);
$content[1] = ereg_replace("<tr bgcolor=\"#CCCCFF\">.*Höchstbietender\/Status","",$content[1]);
$content[1] = ereg_replace("<tr bgcolor=\"#CCCCFF\">.*Höchstbietender\/Status","",$content[1]);
$content[1] = str_replace("</table>", "", $content[1]);
$content[1] = str_replace("</th>", "", $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("<td align=\"center\">", "", $content[1]);
$content[1] = str_replace("<td>", "", $content[1]);
$content[1] = str_replace("<td align=\"right\">", "", $content[1]);
$content[1] = str_replace("<font color=\"\">", "", $content[1]);
$content[1] = str_replace("</font>", "", $content[1]);
$content[1] = str_replace("<tr bgcolor=\"#ffffff\">", "", $content[1]);
$content[1] = str_replace("<tr bgcolor=\"#efefef\">", "", $content[1]);
$content[1] = str_replace("<tr bgcolor=\"#efefef\">", "", $content[1]);
$content[1] = str_replace("</td>", "[ITEMS]", $content[1]);
$content[1] = str_replace("</tr>", "[LINES]\n", $content[1]);
/* freed: 02.09.2004 */
$content[1] = str_replace("<td color=\"\">", "", $content[1]);
// Line used during debug
// echo "<hr />$content[1] <hr />";
// 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 = "<tr><td bgcolor=\"$colour\" align=\"center\">$Item</td><td bgcolor=\"$colour\">$Start</td><td bgcolor=\"$colour\">$End</td><td bgcolor=\"$colour\"><font color=\"#FF0000\">$TimeLeft</font></td><td bgcolor=\"$colour\">$Price</td><td bgcolor=\"$colour\">$Title</td><td bgcolor=\"$colour\">$HighBidder</td></tr>\n";
preg_match('/item=([^"&]*)/', $line, $match);
$itemnum=$match[1];
preg_match('/category=([^"&]*)/', $line, $match);
$catnum=$match[1];
if ($newwindow == 1) {
$tnURL = "<a target=\"_blank\" href=\"http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&category=$catnum&item=$itemnum\"><img src=\"http://thumbs.ebay.com/pict/$itemnum.jpg\" border=\"0\" alt=\"\" /></a>";
$Item = str_replace("a href=", "a target=\"_blank\" href=", $Item);
$HighBidder = str_replace("a href=", "a target=\"_blank\" href=", $HighBidder);
}
else {
$tnURL = "<a href=\"http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&category=$catnum&item=$itemnum\"><img src=\"http://thumbs.ebay.com/pict/$itemnum.jpg\" border=\"0\" alt=\"\" /></a>";
}
// If Thumbnails are enabled show them
if ($thumbs == 1) {
echo "
<tr><td bgcolor=\"#ffffff\" align=\"center\">$tnURL<font size=\"1\">$Item</font></td><td bgcolor=\"$colour\"><font size=\"2\"><strong>$Title</strong></font></td><td bgcolor=\"$colour\"><font color=\"#A71C43\" size=\"2\">$TimeLeft</font></td><td bgcolor=\"$colour\"><font size=\"2\">$Price</font></td><td bgcolor=\"$colour\"><font size=\"1\">$End</font></td></tr>\n";
}
// Otherwise just show the Bid Now link
else {
echo "<tr><td bgcolor=\"#ffffff\" align=\"center\"><font size=\"1\">$Item</font></td><td bgcolor=\"$colour\"><font size=\"2\"><strong>$Title</strong></font></td><td bgcolor=\"$colour\"><font color=\"#A71C43\" size=\"2\">$TimeLeft</font></td><td bgcolor=\"$colour\"><font size=\"2\">$Price</font></td><td bgcolor=\"$colour\"><font size=\"1\">$End</font></td></tr>\n";
}
}
}
// Wrap up the border table
echo "</table></td></tr> </table>";
?>
Anhang anzeigen ebay.zip