Ejemplo n.º 1
0
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
include_once '/home/sdc/includes/functions.php';
$content = '';
$file = 'Get-it-quick_export_articles.csv';
$resContent = getExportContent();
/**
* 100157636
100158071
100157638
100158073
100150757
*
*
*
*/
if ($fh1 = fopen('/home/sdc/bin/export/' . $file, 'r')) {
    $conn_id = ftp_connect(FTP_SERVER);
    $login_result = ftp_login($conn_id, FTP_USER, FTP_PASSWORD);
    ftp_pasv($conn_id, true);
    ftp_chdir($conn_id, FTP_FOLDER);
    if (ftp_fput($conn_id, $file, $fh1, FTP_ASCII)) {
        //echo "$file wurde erfolgreich hochgeladen\n";
    } else {
        echo "{$file} konnte nicht hochgeladen werden\n";
    }
    // Verbindung und Verbindungshandler schlie�en
    ftp_close($conn_id);
<?php

error_reporting(E_ALL);
ini_set("display_errors", 1);
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT');
include_once '/home/sdc/includes/functions.php';
$content = '';
$file = 'Get-it-quick_export_articles.csv';
$content = getExportContent();
$content = iconv('ISO-8859-1', 'UTF-8', $content);
if ($fh = fopen('/home/sdc/bin/export/' . $file, 'w')) {
    fwrite($fh, $content);
    rewind($fh);
    fclose($fh);
    $fh1 = fopen('/home/sdc/bin/export/' . $file, 'r');
    $conn_id = ftp_connect(FTP_SERVER);
    $login_result = ftp_login($conn_id, FTP_USER, FTP_PASSWORD);
    ftp_pasv($conn_id, true);
    ftp_chdir($conn_id, FTP_FOLDER);
    if (ftp_fput($conn_id, $file, $fh1, FTP_ASCII)) {
        echo "{$file} wurde erfolgreich hochgeladen\n";
    } else {
        echo "{$file} konnte nicht hochgeladen werden\n";
    }
    // Verbindung und Verbindungshandler schließen
    ftp_close($conn_id);
    fclose($fh1);
    unlink('/home/sdc/bin/export/' . $file);
} else {
    print 'Datei konnte nicht geoeffnet werden ';
    exit;