grazie della risposta ma non credo che possa usare include al posto di fopen perchè lo scopo è quello di leggere il php con fopen e immagazzinare il contenuto in un file html il codice completo dello script è questo :
codice:
<?php
  // Sets the files we'll be using
  $srcurl = 'http://www.staffords.it/generatexcertp.php'; // This must be a URL!
  $tempfilename = 'tempindex.html';       // This must be a filename!
  $targetfilename = 'index.html';         // Also a filename!
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Generating <?php echo $targetfilename; ?></title>
<meta http-equiv="content-type"
    content="text/html; charset=iso-8859-1" />
</head>
<body>


Generating <?php echo $targetfilename; ?>...</p>
<?php

  // Begin by deleting the temporary file, in case
  // it was left lying around. This might spit out an
  // error message if it were to fail, so we use
  // @ to suppress it.
  @unlink($tempfilename);

  // Load the dynamic page by requesting it with a
  // URL. The PHP will be processed by the Web server
  // before we receive it (since we're basically
  // masquerading as a Web browser), so what we'll get
  // is a static HTML page. The 'r' indicates that we
  // only intend to read from this "file".
  $dynpage = fopen($srcurl, 'r');

  // Check for errors
  if (!$dynpage) {
    exit("

Unable to load $srcurl. Static page update aborted!</p>");
  }

  // Read the contents of the URL into a PHP variable.
  // Specify that we're willing to read up to 1MB of
  // data (just in case something goes wrong).
  $htmldata = fread($dynpage, 1024*1024);

  // Close the connection to the source "file", now
  // that we're done with it.
  fclose($dynpage);

  // Open the temporary file (creating it in the
  // process) in preparation to write to it (note
  // the 'w').
  $tempfile = fopen($tempfilename, 'w');

  // Check for errors
  if (!$tempfile) {
    exit("

Unable to open temporary file ($tempfilename) for writing. 
Static page update aborted!</p>");
  }

  // Write the data for the static page into the
  // temporary file
  fwrite($tempfile, $htmldata);

  // Close the temporary file, now that we're done
  // writing to it.
  fclose($tempfile);

  // If we got this far, then the temporary file
  // was successfully written, and we can now copy
  // it on top of the static page.
  $ok = copy($tempfilename, $targetfilename);

  // Finally, delete the temporary file.
  unlink($tempfilename);

?>


Static page successfully updated!</p>
</body>
</html>
Il problema come dicevo è che è come se fopen si interrompesse prima di finire. E' forse un problema del server? Si può ovviare o devo rinunciare?