{title}
{headline}
By {byline}
{article}
Page generated: {date}
////////////////////////
$page = file_get_contents('article.html');
if ($page === false) {
die("Can't read article.html: $php_errormsg");
}
$vars = array('{title}' => 'A',
'{headline}' => 'B',
'{byline}' => 'C',
'{article}' => "D
",
'{date}' => date('l, F j, Y'));
foreach ($vars as $field => $new_value) {
$page = str_replace($field, $new_value, $page);
}
$result = file_put_contents('dog-article.html', $page);
if (($result === false) || ($result == -1)) {
die("Couldn't write dog-article.html: $php_errormsg");
}
?>