spewn
Programmer
- May 7, 2001
- 1,034
- 0
- 0
i am generating html pages based on name=value pairs...i would like to take the source code of the page i create and save it as an html page, the name of the file being the name=value pairs i used to generate it...
for example:
let's say i create a page using this - index.pl?a=dry-rabbit-food
and the new page that is generated is -
<html>
<title>Dry Rabbit Food</title>
</html>
<body>dry rabbit food is great!</body>
</html>
now, i want to take the source code and then save as a new file, called dry-rabbit-food.html
i want to do this automatically.
similar to this, i use this to create a new html file:
this works great if i already know what i'm going to have on the new html file i create, but on a larger scale, the new page i'm going to create is dynamic, so the above code doesn't help me.
how can i accomplish this?
- g
for example:
let's say i create a page using this - index.pl?a=dry-rabbit-food
and the new page that is generated is -
<html>
<title>Dry Rabbit Food</title>
</html>
<body>dry rabbit food is great!</body>
</html>
now, i want to take the source code and then save as a new file, called dry-rabbit-food.html
i want to do this automatically.
similar to this, i use this to create a new html file:
Code:
#!/usr/bin/perl
use CGI qw(:standard);
$cgi = new CGI;
$cfile0 = "new-html-file.html";
open (COUNTER, "$cfile0");
$count0 = <COUNTER>;
close (COUNTER);
$count0 = "
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
";
open (COUNTER, ">$cfile0");
print COUNTER ("$count0");
close (COUNTER);
print $cgi->header();
print << "EOF";
<html>
<head>
<title></title>
</head>
<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>
new page has been created and saved!
</body>
</html>
EOF
this works great if i already know what i'm going to have on the new html file i create, but on a larger scale, the new page i'm going to create is dynamic, so the above code doesn't help me.
how can i accomplish this?
- g