コード例 #1
0
ファイル: spide.php プロジェクト: BackupTheBerlios/flushcms
function parseContenDetail($url, $data, &$x)
{
    global $logger, $filename, $conf;
    $content = getContent($url);
    if ($content != "") {
        $row_data = array();
        foreach ($data as $key => $value) {
            $row_data[] = StringHelper::handleStrNewline(parseTag($value, $content));
        }
        $row_data[] = $url;
        if (trim($row_data[0]) || trim($row_data[1]) || trim($row_data[2])) {
            File_CSV::write($filename, $row_data, $conf);
            echo "{$x} [Ok].\n";
            $logger->log("Get {$url} content.[Ok]");
        } else {
            echo "{$x} [Fail].\n";
            $logger->log("Get {$url} content.[Fail]");
        }
        $x++;
    }
}
コード例 #2
0
         $categories_products_id_list = array();
         $products_ids = zen_get_categories_products_list($_POST['category_id'], true, true);
         $products_ids = array_unique($products_ids);
         // write line
         foreach ($products_ids as $val) {
             $attributes_ids = zen_get_attributes($val);
             foreach ($attributes_ids as $id) {
                 $data = $ProductCSV->getExportDataOption($id, $format);
                 if (count($data) == 0) {
                     continue;
                 }
                 foreach ($data as $key => $d) {
                     $data[$key] = mb_convert_encoding($d, MODULE_PRODUCT_CSV_EXPORT_CHARACTER, MODULE_PRODUCT_CSV_INTERNAL_CHARACTER);
                     $data[$key] = str_replace("\r\n", "\n", $data[$key]);
                 }
                 File_CSV::write($tempfile, $data, $conf);
             }
         }
         break;
 }
 // output and delete tempfile
 if ($request_type == 'NONSSL') {
     header("Pragma: no-cache");
 } else {
     header("Pragma: ");
 }
 header('Content-Type: application/octet-stream');
 header('Content-Disposition: attachment; filename="' . $prefix . date('YmdHis') . '.csv"');
 header('Content-Length: ' . filesize($tempfile));
 ob_end_clean();
 readfile($tempfile);
コード例 #3
0
ファイル: parser.php プロジェクト: amjadtbssm/website
<?php

$path = ini_get('include_path');
ini_set('include_path', realpath('../') . ":{$path}");
require_once 'File/CSV.php';
/*/Example conf:
$conf = array(
    'fields' => 4,
    'sep'    => "\t",
    'quote'  => '"',
    'header' => false
);
//*/
ob_implicit_flush(true);
$argv = $_SERVER['argv'];
$file = $argv[1];
$write = isset($argv[2]) ? $argv[2] : false;
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "warning: %s\n");
$conf = File_CSV::discoverFormat($file);
while ($fields = File_CSV::read($file, $conf)) {
    if ($write) {
        File_CSV::write($write, $fields, $conf);
    }
    print_r($fields);
}
var_dump($conf);
echo "\n";