Ejemplo n.º 1
0
<?php

//加载初始化文件
include_once '../includes/init.php';
date_default_timezone_set('Asia/Shanghai');
$mallSources = new MallSource();
$mid = $mallSources->getMallId('天猫');
$category = new Category();
/**
 * 存储xml文件
 */
$source = tmall;
$filename = 'xml/' . date('YmdH', time()) . '-' . $source . '.xml';
echo $filename;
$productXml = simplexml_load_file($filename);
/**
 * 提取信息并入库
 */
$results = $productXml->results;
$items = $results->n_tbk_item;
foreach ($items as $item) {
    echo $item->title . '----' . $item->item_url . '<br/><br/>';
}
Ejemplo n.º 2
0
//需要存储记录的总页数
$pageSize = 100;
//每一页的记录数
/**
 * 获取商城id
 */
$mallSouce = new MallSource();
$isTMall = false;
$isTMallStr = 'true';
if ($isTMall) {
    $mallName = '天猫';
} else {
    $mallName = '淘宝';
    $isTMallStr = 'false';
}
$mall_id = $mallSouce->getMallId($mallName);
/**
 * 获取类型
 */
$cate = new Category();
$categories = $cate->getCategory();
$index = 1;
$goodMethods = new Goods();
ob_start();
//打开输出控制缓冲
ob_end_flush();
//输出缓冲区内容并关闭缓冲
ob_implicit_flush(1);
//立即输出
foreach ($categories as $key => $category) {
    if ($index > 1) {