janus57
11/02/2016, 18h17
Envoyé par tristanIT
il me semble que ceci est dans un guide OVH.
EDIT :
confirmé : https://www.ovh.com/fr/g1463.mutuali...hp_ftp_via_php
Cordialement, janus57
$ftp = new FTPClient(); if($ftp->connect($ftp_host, $ftp_login, $ftp_pwd)) { // download datas $ftp->downloadFile('/datas/pfvp.csv', $tmp_datas_path . 'pfvp.csv'); $ftp->downloadFile('/datas/photos.txt.zip', $tmp_datas_path . 'photos.txt.zip');
public function downloadFile($fileFrom, $fileTo) { // transfer mode $asciiArray = array('txt', 'csv'); $extension = end(explode('.', $fileFrom)); if (in_array($extension, $asciiArray)) { $mode = FTP_ASCII; } else { $mode = FTP_BINARY; } // try to download $remote_file and save it to $handle if (ftp_get($this->connectionId, $fileTo, $fileFrom, $mode, 0)) { $this->logMessage(' file "' . $fileTo . '" successfully downloaded'); return true; } else { $this->logMessage('There was an error downloading file "' . $fileFrom . '" to "' . $fileTo . '"'); return false; } }
[Wed Feb 10 07:53:02 2016] [error] [client 10.0.55.81] [host xxxxxxx.cluster007.ovh.net] request failed: error reading the headers
#!/usr/local/bin/php commit(); exit(0); ?>