• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

How would I shell out to exec a OS command...

Here is what I want to do:  A user can log in through the internet and then enter their name and a fax number.  Then they hit a 'submit' button, and a fax gets sent to the number they entered.   How can I do this?  Is Java even the right thing to use?  Any place where I can get source code?

Thanks
0
kellyjj
Asked:
kellyjj
  • 8
  • 4
1 Solution
 
evijayCommented:
You have to write a server side CGI program (in java or in C or in Perl or in any other language) which gets executed when the user clicks submit button.
0
 
kellyjjAuthor Commented:
So I can write it C?  Cool, ok but What do I need to know to make a C program a CGI??  
0
 
kellyjjAuthor Commented:
So I can write it C?  Cool, ok but What do I need to know to make a C program a CGI??  
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
kellyjjAuthor Commented:
So I can write it C?  Cool, ok but What do I need to know to make a C program a CGI??  
0
 
evijayCommented:
I am sorry for late reply,.

First you need to write a html form which accepts the user inputs. Next, attach a cgi handler for the submit
button. The template is like this

<Form method=get action="http://yourhostname/cgi-bin/cgicprogram">

. put form elements here

</Form>


Write your cgicprogram say faxit.c.
It should first get the user entered details from environment variables (using getenv and the variable name is QUERY_STRING,
parse it and then process the request).

For more info on cgi , see the following book

http://www.developer.com/reference/library/1575211513/ewtoc.html


0
 
kellyjjAuthor Commented:
ok cool.  Lets say inside faxit.c  I have the statement system("echo 123 >123.txt");

Will this write 123 to the file 123.txt??  Or is this kind of thing allowed.
0
 
evijayCommented:
Yes perfectly allowed and it writes to file 123.txt

0
 
kellyjjAuthor Commented:
ok, dude,  answer a question and the points are yours
0
 
kellyjjAuthor Commented:
ok, here is another thought...  I can call another app from inside my CGI? Correct.  This what happens when you send e mail from a form.  What do I have to do make this happen.  I keep getting the,  invalid header.

Thanks
0
 
kellyjjAuthor Commented:
Here is the actual error msg that is logged in our server.  What do I do to fix this?

15/Jun/1998:10:34:39] failure: for host 207.126.81.68 trying to GET /cgi-bin/faxcgi.cgi, cgi-parse-output reports: the CGI program /usr/internet/ns_httpd/httpd-80/htdocs/cgi-bin/faxcgi.cgi did not produce a valid header (name without value: got line "vsifax environment not set")

Thanks dude/dudette.
0
 
kellyjjAuthor Commented:
actually,  I got to work.  So if you want the points you should post an answer.

kellyjj
0
 
evijayCommented:
Sorry, I was out of station !!


            First you need to write a html form which accepts the user inputs. Next, attach a cgi handler for the submit
            button. The template is like this

            <Form method=get action="http://yourhostname/cgi-bin/cgicprogram">

            . put form elements here

            </Form>


            Write your cgicprogram say faxit.c.
            It should first get the user entered details from environment variables (using getenv and the variable name is
            QUERY_STRING,
            parse it and then process the request).

            For more info on cgi , see the following book

            http://www.developer.com/reference/library/1575211513/ewtoc.html 
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now