Results 1 to 1 of 1

Thread: Simple php 'write to' script not working??

  1. #1
    Join Date
    Sep 2006
    Posts
    108

    Simple php 'write to' script not working??

    Hi, I am just learning php and in this script I have specified a working link but it is coming up 'can not open file'

    Do you have to specify a link in a certain way other than I did?
    isn't this suppose to destroy the content of test.php and replace it with 'text to replace'?


    <?php

    // set file to write
    $file = 'http://raysantiques.com/test.php';

    // open file
    $fh = fopen($file, 'w') or die('Could not open file!');

    // write to file
    fwrite($fh, "text to replace") or die('Could not write to file');

    echo $file;

    // close file
    fclose($fh);


    I fixed it! I changed the link to just test.php and it works now.
    Last edited by elli; 16 Nov 2007 at 12:27 AM.

Similar Threads

  1. very simple php based cms..
    By pelicanmike in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 19 May 2006, 08:57 AM
  2. Register script not working (php)
    By ilovefishsticks in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 14 May 2006, 01:43 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •