GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 26-Jul-2004, 01:34
sblaw sblaw is offline
New Member
 
Join Date: Jul 2004
Posts: 3
sblaw is on a distinguished road

generating files with php


is it possible to generate files with php as it is with java? i mean, can you have your output written in an text or an xml file?
it IS possible to dynamically generate an xml file, but how to save this output?
thank you very much for your help!
  #2  
Old 07-Aug-2004, 09:31
cs2 cs2 is offline
Member
 
Join Date: May 2003
Location: California
Posts: 107
cs2 will become famous soon enough
You can't do it in a single step, but I think fwrite will do what you want.
__________________
The Whole Internet, LLC
Visit our Homepage, -or-
use our online CSS Editor
  #3  
Old 09-Aug-2004, 10:52
tubedogg tubedogg is offline
New Member
 
Join Date: Aug 2004
Posts: 11
tubedogg will become famous soon enough
This is some psuedo-code that would do what you want:
PHP Code:

<?

$myfile = '/home/example/public_html/test.xml';
$myoutput = 'This is some sample text.';

// open the file, the 'w' indicates we wish to erase the contents and write from the beginning of the file. you could also use 'a' to append the existing contents.
$fp = fopen($myfile, 'w');
// write to the file
fwrite($fp, $myoutput);
// close the file
fclose($fp);

?>

  #4  
Old 10-Aug-2004, 00:04
JasonMichael's Avatar
JasonMichael JasonMichael is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 135
JasonMichael has a spectacular aura about
I have a program that basically rewrites code I use for my Content Management system, everytime I add a new module. I create a table in the database and it rewrites the code to access the new table that the module will use.

Anyway, the problems I ran into early on in the project was making sure that PHP had proper permission to write to the directory. I believe I also had to use the umask function to make sure that all files written would get certain permissions. I would call umask, before doing anything file writes (fwrite).
 
 

Recent GIDBlogObservations of Iraq by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
uisng php to display php dopee MySQL / PHP Forum 6 14-May-2004 18:40
Can't view pages from another machine on the Intranet aevans Apache Web Server Forum 9 14-May-2004 02:26
php & txt files dopee MySQL / PHP Forum 5 06-May-2004 03:05
PHP in HTML jrobbio Web Design Forum 4 24-Jul-2003 06:05
All the big PHP script collections that matter jrobbio MySQL / PHP Forum 5 06-Jun-2003 16:14

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:43.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.