Search code examples
phpphp4

PHP: how to create and ftp a file to another server?


We are setting up a drop-ship agreement with a vendor to where we don't have to stock their products we just sell them and they ship them out. To inform them of an order they want us to FTP upload a tab delimited .txt file with the order info to their site. We want to automate this. So given the user/pass for the ftp is there a way to create a TSV.txt file and ftp upload it to their site with PHP?

Thanks!


Solution

  • PHP FTP Example

    I'm not familiar with your order info of course, but you could create an array of the order information and use fputcsv to create the tab delimited file.

    Do you need specifics on making the file from $_POST information as well? Or just general function calls to implement the solution?

    Edit: Also, is it possible to find another solution then FTP'ing the information? Say, an HTTPS connection or something to their server? If you are sending any recipient information(address, zip, credit card) this could be a security problem.