Mar 23
If you are releasing an application and need it to be able to update its self you can use fopen to open a remote file. for example:
1 2 3 4 5 6 7 8 9 10 11 12 | <?php if($fp = fopen("http://server/file-to-update-from", "r")) { $content = ''; while($line = fread($fp, 1024)) { $content .= $line; } fclose($fp); $fh = open("localfile-to-update", "w"); # you can use "a" for append if needed fwrite($fh, $content);= fclose($fh); } ?> |
As you can see its very simple to do. You can then create a cron job which will run this update application to check for updates every so often.
Thanks
- Alex
Recent Comments