#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    41
    Rep Power
    15
    I need to know how to open a file, search for a certain spot, write some information, and then close the file...I'm fairly new to PHP. Can someone help me out?
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    You can find out some tutorials for this topic at thickbook.com

    ----------------------
    But i am writing a small example .. how to write a file and read from a file..


    first start with writing to a file...

    <?
    $message="hi, this i am going to write to flatfiles";

    $file=fopen("test.txt","w");
    //open file for only writing
    fputs($file,$message);
    //just write above message to test.txt
    fclose($file);
    //close file..
    echo "Hi file updatedn";

    ?>
    Now read that message from the file

    <?
    $file=fopen("test.txt","r");
    //open file for only reading
    $txt=fputs($file,filesize("test.txt"));
    //get the full text information txt variable
    fclose($file);
    //close file..

    // now your $txt variable holds whole texts from that file..
    ?>
    ...........

    Here you can search for special value in your $txt variable and you can replace with new value...Then you should open the file again and write that new value to the file..





    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

Similar Threads

  1. read iframe html.....write to form, string..etc.
    By dave777 in forum HTML Programming
    Replies: 0
    Last Post: February 2nd, 2004, 12:27 PM
  2. read iframe html.....write to form, string..etc.
    By dave777 in forum HTML Programming
    Replies: 1
    Last Post: February 2nd, 2004, 10:14 AM
  3. read iframe html.....write to form, string..etc.
    By dave777 in forum PHP Development
    Replies: 2
    Last Post: February 2nd, 2004, 10:11 AM
  4. Open window and close window
    By reneoost in forum HTML Programming
    Replies: 1
    Last Post: January 30th, 2004, 12:48 PM
  5. How to read multiple line text file into a variable
    By gatewaycityca in forum Visual Basic Programming
    Replies: 4
    Last Post: January 29th, 2004, 12:26 PM

IMN logo majestic logo threadwatch logo seochat tools logo