andyxfun
08-22-2009, 08:48 AM
ok,i posted something similar but this is an exact question now:
how do i save an html page code using php?
:)
so let's say i have this page as a template:
<html>
<head>
<title>%title%</title>
</head>
<body>
<p>
Hello, my name is %name% and i am %age% years old!
</p>
</body>
</html>
and i have program.php:
<?php
// load the contents of template file
$html = file_get_contents('my_template.htm');
// search for the following
$search = array('%title%', '%name%', '%age%');
// replace it with the following
$replace = array('Personel Page', 'Latheesan', 21);
// do the actual search & replace
str_replace($search, $replace, $html);
// print the page
echo $html;
?>
now i have a nice html page,how do i save it to the server let's say save/html page/
i'm really noob in php so please help...:)
how do i save an html page code using php?
:)
so let's say i have this page as a template:
<html>
<head>
<title>%title%</title>
</head>
<body>
<p>
Hello, my name is %name% and i am %age% years old!
</p>
</body>
</html>
and i have program.php:
<?php
// load the contents of template file
$html = file_get_contents('my_template.htm');
// search for the following
$search = array('%title%', '%name%', '%age%');
// replace it with the following
$replace = array('Personel Page', 'Latheesan', 21);
// do the actual search & replace
str_replace($search, $replace, $html);
// print the page
echo $html;
?>
now i have a nice html page,how do i save it to the server let's say save/html page/
i'm really noob in php so please help...:)
