Jump to content


danbr

Member Since 17/06/2006
Offline Last Active 17/06/2006, 20:14
-----

Posts I've Made

In Topic: Mercado Livre como Parceiro?

17/06/2006, 20:14

salvei como scriptshopping.php

Obrigado pela atenção

In Topic: Mercado Livre como Parceiro?

17/06/2006, 10:39

baixe este este script no mercadolivre so que não sei como configurá-lo. Alguém poderia me ajudar?

<?
$id_categ=$HTTP_GET_VARS[categoria];
$buscar=$HTTP_GET_VARS[keyword];
$pais=strtoupper($HTTP_GET_VARS[pais]);
$preco=$HTTP_GET_VARS[preco];
$max=$HTTP_GET_VARS[max];
$siteID="343425";

switch ($pais) {
case "MLB":
$dominio="www.mercadolivre.com.br";
break;
case "MLP":
$dominio="www.mercadolibre.com.pe";
break;
default:
$dominio="www.mercadolivre.com.br";
}?>
<html>
<head>
<style type="text/css">
.precio {
font-family: Tahoma, Helvetica, sans-serif;
font-size: 10px;
color: #CC0000;
</style>
</head>
<body topmargin="0" leftmargin="0" >
<dl>
<table width="468" height="60" order="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" align="center"><tr>
<?php

$insideitem = false;
$item = array();
$tag = "";
$title = "";
$link = "";
$price = "";
$image="";
$currency= "";
$count = 1;

function startElement($parser, $name, $attrs) {
global $insideitem, $tag, $title, $link, $price, $image, $currency, $item, $count;
if ($insideitem) {
$tag = $name;
} elseif ($name == "ITEM") {
$insideitem = true;
}
}

function endElement($parser, $name) {
global $insideitem, $tag, $title, $link, $price, $image, $currency, $item, $attrs, $count, $max;
if ($name == "ITEM") {
echo "<td align=\"center\" valign=\"middle\" style=\"padding:10px\">";
echo "<img width=\"90\" height=\"90\" src=\"".$image."\" align=\"center\" valign=\"middle\" >";
echo "<div style=\"word-wrap: break-word; width:140px\"><a href=\"".$link."\" target=\"_blank\">".$title."</a><br><img height=\"3\" src=\"spacer.gif\" align=\"center\" valign=\"middle\" ><br>";
echo "<font class=\"precio\">por apenas <b>".$currency.$price."<br></b></font></div></td></strong>";
$title = "";
$link = "";
$price = "";
$item = "";
$image = "";
$currency = "";
$insideitem = false;
$count = $count + 1;
if ($count == 4)
{
echo "</tr><tr><td height=\"15px\"> </td></tr><tr>";
$count = 1;
}
}
}

function characterData($parser, $data) {
global $insideitem, $tag, $title, $link, $price, $image, $currency, $item, $attrs, $siteID;
if ($insideitem) {
switch ($tag) {
case "ITEM":
$id .= $item['ID'];
break;
case "TITLE":
$title .= $data;
break;
case "LINK":
$link .= str_replace("XXX",$siteID,$data);
break;
case "PRICE":
$price .= $data;
break;
case "IMAGE_URL":
$image .= $data;
break;
case "CURRENCY":
$currency .= $data;
break;
}
}
}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
$fp = fopen("http://".$dominio."/jm/searchXml?as_categ_id=".$id_categ."&as_word=".$buscar."&as_price_min=".$preco."&as_order_id=MAS_OFERTADOS&as_filtro_id=PRECIO_FIJO&as_display_type=G&noQCat=Y&as_qshow=".$max."","r")
or die("Error reading data.");
while ($data = fread($fp, 4096))
xml_parse($xml_parser, $data, feof($fp))
or die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
fclose($fp);
xml_parser_free($xml_parser);

?>
</dl>
</table>
</body>

IPB Skin By Virteq