Due to issues with the Internet.ee domain registry, our main domain, paste.ee, is currently disabled due to abuse reports. We are looking into alternative domains to continue operation, but for now the pastee.dev domain is the primary domain.
If you wish to blame someone, blame the scum using this site as a malware host.
Description: PHP Proxy Script - Download via FTP
Submitted by trey on March 1, 2017

New Paste 1 (PHP)

<?php
$ftp = array(
	'server' => 'ftp.example.com',
	'user' => 'yourusername',
	'pass' => 'yourpassword'
);

// Connect
$ftp_connection = ftp_connect( $ftp['server'] ) or die( 'Could not connect to $ftp[$server]' );

// Set passive mode
ftp_pasv( $ftp_connection, false );

if ( $login = ftp_login( $ftp_connection, $ftp['user'], $ftp['pass'] ) ) {

	// Login passed
	
	// Download data to this file.
	$local_file = 'datafeed.csv.';

	// Path and filename to open and read from.
	$server_file = 'public_html/ftpfiles/data-example-2.csv';

	// Download File
	if ( $file = ftp_get( $ftp_connection, $local_file, $server_file, FTP_ASCII ) ) {

		$handle = fopen( $local_file, "r" ) or die( "Couldn't get handle" );

		if ( $handle ) {

		    while ( !feof( $handle ) ) {

		    	// Output data.
		        $buffer = fgets( $handle, 4096 );
		        echo $buffer;

		    }

		    fclose( $handle );

		} else {

			// $handle failed
			echo "Failed to get handle.";

		}

	} else {

		// ftp_get failed
		echo "Failed to download file.";

	}

} else {

	// Login failed
	echo "Failed to log in.";

}

// Disconnect
ftp_close( $ftp_connection );
?>