15.01.2010, 12:00
Hey,
I'm bad at PHP (but understand a little), and I've got this code (explanation what I want inside the code):
I'm bad at PHP (but understand a little), and I've got this code (explanation what I want inside the code):
PHP код:
$conn = ftp_connect("FTP SERVER") or die("Sorry!<br /> Database is unavailable at the moment!"); // Connecting to remote FTP
ftp_login($conn,"LOGIN","PASS");
ftp_get($conn,"file.sav","directory/name.sav",FTP_ASCII); //Taking file from the server
$file = "file.sav";
/*
file.sav would look like this:
--------------------------
parameter1=12345
parameter2=1234
parameter3=13456
parameter4=134894
parameter5=123
(Numbers are random here)
*/
$handle = fopen($file, 'r+'); //( r+ - Read/Write. Starts at the beginning of the file)
$data = fread($handle, filesize($file)); // Reads the data (hope this works)
if($data)
{
if(stristr($data,"parameter3") != FALSE) // Don't know if this is right
{
//I need to get value of parameter3, and change it to 999 or something..
}
}
//And then it should save the file and upload it to remote FTP server..
ftp_close($conn);//Closing connection
*/