-
-
Save boywondercreative/0d4bdc8779d9eabb6a8c32f7a45b3f46 to your computer and use it in GitHub Desktop.
This script reads the specified file over FTP and outputs it over HTTP. Thus, you can point WP ALL Import at the URL for this script on your server to provide a "bridge" between FTP and HTTP. This is provided with the hope it will be useful but custom PHP and importing over FTP is not officially supported.
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 characters
| <?php | |
| /* | |
| * Security note: Anyone could access your data if they guess this URL. | |
| * You should remove this file from the server after importing or rename | |
| * to something "unguessable" (e.g. 'ftp-proxy-24dxfi3.php') But understand, | |
| * that method is not perfectly secure. For best security use an .htaccess | |
| * rule allowing access only from localhost. | |
| */ | |
| // Enter the FTP (or HTTP) URL of your data file here. | |
| $url = "ftp://username:password@hostname.com/path/to/file.csv"; | |
| // These headers aren't strictly needed but can be helpful | |
| header('Content-Type: text/plain'); | |
| header('Content-Disposition: attachment'); | |
| header('Pragma: no-cache'); | |
| // Fetch the file and echo it | |
| readfile($url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment