-
-
Save Programmer095/2cdf89553f1eb286742387aa617520a0 to your computer and use it in GitHub Desktop.
Revisions
-
Programmer095 revised this gist
Dec 18, 2017 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,11 @@ <?php /* ################### READ ME ################################# You must create a proxy file that retrieves your import file from FTP and then returns it. You will then call that file with the 'Download from URL' option in WP All Import. This is an example of such a proxy file. This is provided in the hopes it is useful, but without any support. ############################################################### */ $ftp = array( 'server' => 'ftp.example.com', 'user' => 'yourusername', -
trey8611 created this gist
Jun 10, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ <?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 ); ?>