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]<?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=“serverPassword”;
/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”;
}
?>[/php]