By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,603 Members | 1,062 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,603 IT Pros & Developers. It's quick & easy.

how can create using shell script and develop the web page

P: 11
How can create web page using shell script.......

Like web page like

winner of the month(given the input) = john
type of the prize(given the input)= gold

the given page like


winner of the month john
type of the prize gold

please help

bye
gupta
Jul 24 '08 #1
Share this Question
Share on Google+
3 Replies

P: 57
You probably need to provide a little more information...It's not immediately clear exactly what you want to do

Here are some helpers/ideas along the way....

Expand|Select|Wrap|Line Numbers
  1. #Read a variable
  2. read NAME
  3.  
  4. #output header1 html tag 
  5. echo "<h1> ${NAME} </h1>"
  6.  
  7.  
Piping your output to a file will help in creating a page - you will still need to open it through a browser...
It might be a lot of work, though, as you would need to create all the tags around it as well....you might want to read them from a pre-prepared file
Of course, you can call shell commands through PHP scripts on a web page - and have them output the result back to the php page being generated....

Post back with more info if I'm way off track with what you want to do....
Jul 24 '08 #2

P: 11
yes i want open file from browser and display the information what ever given the input in the web page itself

please help

gupta


You probably need to provide a little more information...It's not immediately clear exactly what you want to do

Here are some helpers/ideas along the way....

Expand|Select|Wrap|Line Numbers
  1. #Read a variable
  2. read NAME
  3.  
  4. #output header1 html tag 
  5. echo "<h1> ${NAME} </h1>"
  6.  
  7.  
Piping your output to a file will help in creating a page - you will still need to open it through a browser...
It might be a lot of work, though, as you would need to create all the tags around it as well....you might want to read them from a pre-prepared file
Of course, you can call shell commands through PHP scripts on a web page - and have them output the result back to the php page being generated....

Post back with more info if I'm way off track with what you want to do....
Jul 24 '08 #3

P: 57
You can do this a number of ways.
Basically (if I understand waht you want to do), you want to create a file from a script, and later open the information generated by that script in a browser.

There are probably at least two reasonably simple approaches
1) you could directly generate the HTML from the script - probably long and tedious
2) you could save the information to a temporary file, which may or may not contain some HTML formatting, and have a generic file (in say php) to create a page using the information in that file.

Probably what I would do, is redirect the output to a .csv file which would look something like (result.csv):

[code]
winner, John
prize, Gold
[code]

you then create a file which includes something like the following php (lottery.php) {I haven't made sure that works so their may be little oversights in it}:
Expand|Select|Wrap|Line Numbers
  1. <? 
  2. //Check File exists
  3. if(exists_file("result.csv'"))
  4. {
  5. //Open file for reading
  6.   $myfile=fopen("result.csv". "r");
  7.   //read the csvlines - note 1000 here is >= file length- may need to extend if you open bigger files 
  8.   while (($line = fgetcsv($myfile,1000,",")!=false)
  9.   {
  10.     echo "<h2>".$line[0]." is ".$line[1]."!!";
  11.   }
  12. }
  13. ?>
  14.  
Jul 24 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.