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.
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 
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.
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.
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!
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);
?>
|
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.
| 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-