Solved

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

Posted on 1998-06-12
12
217 Views
Last Modified: 2008-03-06
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
Comment
Question by:kellyjj
  • 8
  • 4
12 Comments
 
LVL 4

Expert Comment

by:evijay
ID: 1222972
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
 
LVL 2

Author Comment

by:kellyjj
ID: 1222973
So I can write it C?  Cool, ok but What do I need to know to make a C program a CGI??  
0
 
LVL 2

Author Comment

by:kellyjj
ID: 1222974
So I can write it C?  Cool, ok but What do I need to know to make a C program a CGI??  
0
 
LVL 2

Author Comment

by:kellyjj
ID: 1222975
So I can write it C?  Cool, ok but What do I need to know to make a C program a CGI??  
0
 
LVL 4

Expert Comment

by:evijay
ID: 1222976
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
 
LVL 2

Author Comment

by:kellyjj
ID: 1222977
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Expert Comment

by:evijay
ID: 1222978
Yes perfectly allowed and it writes to file 123.txt

0
 
LVL 2

Author Comment

by:kellyjj
ID: 1222979
ok, dude,  answer a question and the points are yours
0
 
LVL 2

Author Comment

by:kellyjj
ID: 1222980
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
 
LVL 2

Author Comment

by:kellyjj
ID: 1222981
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
 
LVL 2

Author Comment

by:kellyjj
ID: 1222982
actually,  I got to work.  So if you want the points you should post an answer.

kellyjj
0
 
LVL 4

Accepted Solution

by:
evijay earned 30 total points
ID: 1222983
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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Non-recursive backtracking, using a stack 1 96
micro services spring boot application error 3 139
Java SE 8u111  Lot of stuff broke 11 52
factorial example 4 34
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now