Auktionen in Webseite integrieren

Lektor21

Erfahrenes Mitglied
Hallo!

Wollte mal ein Script posten, was ich gefunden habe! Damit kann man seine eBay - Auktionen auf der eigenen Webseite anzeigen!

Könnte mal noch jemand drüberschauen, ob man noch etwas entfernen kann, was überflüssig ist? Habe selbst schon etwas gecleant was man nicht braucht!

PHP:
<?php

// Ebayname
$ebayid = "#####"; 
  
// Table Border Color
$table_border_color = "#FFFFFF"; 
  
// Table Header Color
$table_header_color = "#ff7b10"; 
  
// Table Color Row 1
$table_row1_color = "#e9e9e9"; 
  
// Table Color Row 2
$table_row2_color = "#DCDCDC"; 
  
// Display (-1 = Current | 1 - 30 = Up to 30 Days)
$since = "-1"; 
  
//Sort (Item Number = 1 | Auction Start = 2 | Auction End = 3 | Current Price = 4 | Newest First = 8)
$sort = "3";
  
echo "<h3><b>Unsere aktuellen Angebote bei eBay</b></h3>
      <br> 
      <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 align=\"center\" bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Artikel</strong></font></td>         
      <td align=\"center\" width=\"100%\" bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Beschreibung</strong></font></td> 
      <td align=\"center\" bgcolor=\"$table_header_color\"><font color=\"FFFFFF\" size=\"2\"><strong>Preis</strong></font></td> 
      </tr>"; 
  
$URL = "http://cgi6.ebay.de/ws/eBayISAPI.dll?MfcISAPICommand=ViewListedItems&userid=$ebayid&since=$since&sort=$sort&rows=0";  
  
$Start = "Zum Sortieren klicken Sie auf die Spaltenüberschriften"; 
$GrabEnd = ""; 
  
$file = fopen("$URL", "r"); 
  
if (!function_exists('file_get_contents')) 
{ 
     $r = fread($file, 80000); 
}  
else 
{ 
    $r = file_get_contents($URL);   
}  
  
$stuff = eregi("$Start(.*)$GrabEnd", $r, $content); 
  
$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]); 
  
$content[1] = str_replace("<td color=\"\">", "", $content[1]); 
  
fclose($file); 
  
$stuff = $content[1]; 
  
$items = explode("[LINES]",$stuff); 
  
$count = "0"; 
  
foreach ($items as $listing) 
{ 
  
list($Item,$Start,$End,$Price,$Title,$HighBidder ) = explode("[ITEMS]",$listing); 
  
$seperate = split('[. :]', $End); 
  
$day = $seperate[0]; 
$month = $seperate[1]; 
$year = $seperate[2]; 
$hour = $seperate[3];  
$minute = $seperate[4]; 
$second = $seperate[5]; 
  
$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;  
  
$Time_Left =  $days . " Tag(e)" . " " . $hours . " Stunde(n)" . " " . $minutes . " Minute(n)"; 
         
if ($seconds < 0) 
{ 
$TimeLeft = "<font color='#FF0000'>Beendet</font>"; 
} 
else 
{ 
$TimeLeft = $Time_Left; 
} 
  
if ($Start && $End && strip_tags($Price) && $Title) 
{ 
  
$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];  
  
$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);                     
 
echo "<tr><td bgcolor=\"$colour\" align=\"center\">$tnURL</td><td bgcolor=\"$colour\"><font size=\"2\"><strong><a target=\"_blank\" href=\"http://cgi.ebay.de/ws/eBayISAPI.dll?ViewItem&category=$catnum&item=$itemnum\">&nbsp;$Title</a></strong></font><br><br><font color=\"#150185\">&nbsp;Restzeit:&nbsp;$TimeLeft</font></td><td align=\"center\" bgcolor=\"$colour\"><font size=\"2\" color=\"#008000\">$Price</font></td></tr>\n"; 

}
         
} 

echo "</table></td></tr></table>"; 
  
?>
 
Zuletzt bearbeitet:
Warum meldest du dich nicht kostenlos für die E-Bay API an? Dann kannst du per XML-RPC auf deine Auktionen zugreifen, könntest auch neue Einstellen und was weis ich alles.
 
Zurück