将易趣物品/导入导出到ZenCart

时间:2010-12-20 14:00:29

标签: php mysql excel ebay zen-cart

只是想知道是否有人做了以下事情,甚至指出了我正确的方向;

  1. 有没有人从ebay商店出口ebay商品?
  2. 将这些项目导入ZenCart
  3. 干杯

    沙恩

2 个答案:

答案 0 :(得分:2)

为了类似的目的,我使用PHP创建了一个Web scraper。它实际上非常简单。您可以抓取数据并将其写入数据库。以下是摘录摘录:

function get_web_page( $url )
{
    $options = array(
        CURLOPT_RETURNTRANSFER => true,     // return web page
        CURLOPT_HEADER         => false,    // don't return headers
        CURLOPT_FOLLOWLOCATION => true,     // follow redirects
        CURLOPT_ENCODING       => "",       // handle all encodings
        CURLOPT_USERAGENT      => "spider", // who am i
        CURLOPT_AUTOREFERER    => true,     // set referer on redirect
        CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
        CURLOPT_TIMEOUT        => 120,      // timeout on response
        CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
    );

    $ch      = curl_init( $url );
    curl_setopt_array( $ch, $options );
    $content = curl_exec( $ch );
    $err     = curl_errno( $ch );
    $errmsg  = curl_error( $ch );
    $header  = curl_getinfo( $ch );
    curl_close( $ch );

    //$header['errno']   = $err;
   // $header['errmsg']  = $errmsg;
    //$header['content'] = $content;
    // print($header[0]);
    return $content;
}


$content = get_web_page($baseUrl);

$dom = new DOMDocument();
@$dom->loadHTML($content);

$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate("/html/body//a");

// $hrefs->length
for ($i = 0; $i < $hrefs->length; $i++) {
    $href = $hrefs->item($i);
    $url = $href->getAttribute('href');
    // process parts and write data to database
}

答案 1 :(得分:0)

您可以将自己的ebay数据导出为CSV文件,然后使用商店Manager for Zen Cart将其导入ZenCart