Hi, I am very new in this language and I have some problems and I can`t handle it.
Maybe somebody can help me?
file_put_conten ts and fopen does not work for my and I don´t know what happen :S
Abstract:
1. I need read a random line in a txt hosted in a FTP
2. I need delete this randome line from that txt
3. Next I need put the extracted random line in another txt (not coded yet)
Here is my code:
I tried by 2 ways write some files in my host:
file_put_conten ts($file, "sometext", FILE_APPEND);
AND
$fh = fopen("$file", "w");
fwrite($fh, "sometext") ;
fclose($fh);
But those does not work. I put this file 0777 permitions and does not work :S
Someone knows what happening?
PHPversion: 5
Host: http://www.x10hosting.com/
Thanks in advance.
Regards
Maybe somebody can help me?
file_put_conten ts and fopen does not work for my and I don´t know what happen :S
Abstract:
1. I need read a random line in a txt hosted in a FTP
2. I need delete this randome line from that txt
3. Next I need put the extracted random line in another txt (not coded yet)
Here is my code:
Code:
/***************************************/ $file = "ftp://USER:PASS@ftp.myftp.x10.bz/words2.txt"; $lines = count(file($file)); $topic = explode("\n", file_get_contents($file)); $random = rand(0,$lines); $random_topic = $topic[$random]; unset($topic[$random]); file_put_contents($file, implode('', $topic), LOCK_EX); /****************************************/
file_put_conten ts($file, "sometext", FILE_APPEND);
AND
$fh = fopen("$file", "w");
fwrite($fh, "sometext") ;
fclose($fh);
But those does not work. I put this file 0777 permitions and does not work :S
Someone knows what happening?
PHPversion: 5
Host: http://www.x10hosting.com/
Thanks in advance.
Regards
Comment