When someone comes to my website via url: http://domain.com/FILE_ID, PHP would connect to the ftp server and get FILE_ID and then stream it to client without saving it on the local server. I don’t want to provide my clients with a link to my file on ftp server instead I thought of this.
Does anyone have an idea how I can accomplish this?
I was thinking I could use “ftp_get()” method to get the file from ftp but that requires me to write in on a local server(or am I wrong?). After that use PHP headers to force the download.
Basically any and every piece of information would be useful. Just so I can start walking in the right direction.
What you are after is the Curl library – as it can handle FTP. See this, it has an FTP example.
Alternatively, if you’ve got a server that has URL bindings for file_get_contents, you can use
to get the contents of a remote file on an FTP server.