jojossdk Posted March 23, 2012 Share Posted March 23, 2012 Hello!!! Everbody is there anyone out there who can help me? I have this script which is programmed to receive data from an android app and save it as txt file. txt files will automatically save in the same folder as the php file is located in. but I want it to store files on an activ FTP server instead. Someone who can change it for me? There is the username and password to ftp server <?php /* * Written By: René Ibsen * Date: 2012/03/21 * * */ /************************************CONFIG****************************************/ //SETTINGS// //This code is something you set in the APP so random people cant use it. $ACCESSKEY="password"; /************************************CONFIG****************************************/ //these are just in case setting headers forcing it to always expire and the content type to CSV header('Cache-Control: no-cache, must-revalidate'); header('Content-type: text/csv'); error_log(print_r($_POST,TRUE)); if( isset($_POST['export']) && isset($_POST['key']) ){ //checks ifthe tag post is there and if its been a proper form post if($_POST['key']==$ACCESSKEY){ ///validate the ACCESS key $export=urldecode($_POST['export']); $outstream = fopen('./export'.date("YmdHis").'.txt', 'w'); fputs($outstream, $export); fclose($outstream); echo $export; //writes out csv data back to the client } else { header("HTTP/1.0 400 Bad Request"); echo "Bad Request"; //reports if the code is bad } } else { header("HTTP/1.0 400 Bad Request"); echo "Bad Request"; } ?> 17857_.php Quote Link to comment https://forums.phpfreaks.com/topic/259529-need-help-with-auto-save-on-ftp-server/ Share on other sites More sharing options...
jojossdk Posted March 25, 2012 Author Share Posted March 25, 2012 ?? Quote Link to comment https://forums.phpfreaks.com/topic/259529-need-help-with-auto-save-on-ftp-server/#findComment-1330958 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.