PHP

UPLOAD & DOWNLOAD THROUGH FTP IN PHP

CONNECT TO FTP SERVER $ftp = ftp_connect("HOST");

LOGIN & UPLOAD if (ftp_login($ftp, "USER", "PASS") {   ftp_put($ftp, "DESTINATION",   "SOURCE", FTP_BINARY) }

CLOSE CONNECTION ftp_close($ftp);

PHP FTP UPLOAD

01

CONNECT TO FTP SERVER $ftp = ftp_connect("HOST");

LOGIN & DOWNLOAD if (ftp_login($ftp, "USER", "PASS") {   ftp_get($ftp, "DESTINATION",   "SOURCE", FTP_BINARY); }

CLOSE CONNECTION ftp_close($ftp);

PHP FTP DOWNLOAD

02

INIT CURL + OPEN FILE $curl = curl_init(); $file = fopen("DESTINATION", "w");

CURL OPTIONS curl_setopt_array($curl, [   CURLOPT_URL => "URL",    CURLOPT_USERPWD => "USR:PASS",   CURLOPT_RETURNTRANSFER => 1,    CURLOPT_FILE => $file ]);

CURL FTP DOWNLOAD curl_exec($curl); curl_close($curl); fclose($file);

CURL FTP DOWNLOAD

03

INIT CURL + OPEN FILE $curl = curl_init(); $file = fopen("SOURCE", "r");

CURL OPTIONS curl_setopt_array($curl, [   CURLOPT_URL => "URL",    CURLOPT_USERPWD =>"USR:PASS",    CURLOPT_UPLOAD => 1,    CURLOPT_INFILE => $file,    CURLOPT_INFILESIZE =>      filesize(SOURCE) ]);

CURL FTP UPLOAD + CLOSE curl_exec($curl); curl_close($curl); fclose($file);

CURL FTP UPLOAD

04