只是想知道是否有人做了以下事情,甚至指出了我正确的方向;
干杯
沙恩
答案 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