FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Creating files not locally?





Diablosblizz
Hey, I was wondering if there is any way for a PHP script to create files that are not on the local server. I want to create some text files (mostly logs each month) on my server from Frihost. So, Frihost would make them on my computer (or as I call my server).

I was thinking the PHP FTP command, cause I know that would work but it would have to create multiple files and it would have to input information into the files (they will all be .txt files).

Does anybody know if this is possible? Kind Regards.
alalex
Well, php could probably create those files in the frihost server. Now have php move them to your computer is probably more difficult, although not impossible for sure.
The only easy way to do this I can think of is have php installed on your computer, and have it connect to your frihost server, store the logs preferably in a database, but it would work also in a text file, and then have it store it locally, so that your local script would take the info remotely and store it locally, which I think is easier then have it all work remotely...

have luck with this Wink
Diablosblizz
Sorry, maybe I should have explained a bit more. I also wanted to log each member (for my site) when they sign up. This is going to be for a backup. I could just backup the database, but I want to learn some PHP by doing this, and I don't want to use MySQL.

My computer does have Apache and PHP, so there is no problem there.
rvec
if you can access your apache server from outside you could use $POST to send the file to your pc from the frihost server and then write the file locally.

If not you need an ftp server on your pc. Or you have to create a buffer on the frihost server and get the files each hour or each day or .... I think the easiest way to do this would be some synchronization future from an ftp program.
Diablosblizz
I really like the post idea, probably because I know how to do posts and create files with them (I hope). I do have a FTP server, as I said, it's FileZilla. I would need it to be instantly, so that's why I think that the post would work perfectly fine.

I don't expect too many people to be registering at the same time, so therefore it should be fine. Anyways, thanks. If anybody has any more ideas please post!
mahirharoon
my code

Code:

<?php
//file to write
$filename = mess.txt;
//what to write
$content = "sometihng here";
//handle (opener)
$handle = fopen($filename, 'a');
//write the message
fwrite($handle, $message);
//close the handle
fclose($handle);
?>
Diablosblizz
Yes, mahirharoon, this is exactly what I am using, except I forgot about the fwrite which I also need. Thank you very much! This topic can be closed.
rvec
Diablosblizz wrote:
Yes, mahirharoon, this is exactly what I am using, except I forgot about the fwrite which I also need. Thank you very much! This topic can be closed.

-close-
Related topics
Help: SQL error after uploading new files(thread updated)
trying to put up forums... help?
Problem with tar.gz files
websites with Drupal
Joomla /tmp/ file.
Current HDD Setup? OS Config?
Backup Programs..
Need help with logger script. (half done)
Questions..
Google Web Accelerator-A free software to load pages faster.
i cannot open a file with fopen()
PHP reading a line?
MySQL and DA problems on server 2
PHP ASSISTENCE REQUIRED PLEASE
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.