Solved

linking two cgi scripts

Posted on 1997-07-02
9
178 Views
Last Modified: 2013-12-25
i have a form on my web page that i use for people to send pages to my alphanumeric pager.  First, they fill out a form and hit a button, and that perl script mails me the content of their page, and then builds another page with another button on it that they have to hit to run another cgi
script on another pc that i don't have access to...

what i'd like to do is combine these steps..is there a way for me to run the first script,and then hand off the processing to the 2nd script on another computer?  or maybe make the first script open up lynx on my account and enter the data on the 2nd site, returning data whether it
worked or not?

you can see what i'm talking about by going to my web page @ http://www.tensionboy.com/contact.html

0
Comment
Question by:tonysebion
  • 5
  • 3
9 Comments
 
LVL 5

Expert Comment

by:icd
Comment Utility
As far as I can tell, you have two scripts. The first is one you wrote that logs for your purposes who made the 'call' and the second is one provided by (presumably) the pager company.

My first impression was that you should just include the hidden fields on the second page as hidden fields in the first page, but then I realised you were probably doing further logging.

The next option is to use Javascript or a META command so that when your first script is run it does a refresh to automatically run the second script after a short pause.

The best approach however might be to re-write the second script so that it produces no output (unless there is an error detected), it just carries out the logging function. It would then need to request the document produced by the second script using http and output the result to stdout. In that way although both scripts are run, only the output of the second script is shown.

How to do this will vary depending upon the server software. I have a solution if the server is running on Win95 or NT. If it is UNIX then my code would not work but a similar approach could be worked out.
0
 
LVL 5

Expert Comment

by:icd
Comment Utility
Sorry, that should read 'The best approach might be to re-write the *first* script'
0
 

Author Comment

by:tonysebion
Comment Utility
okey, if you go to the page and follow it, the first form you fill out (and hit send on) runs a little perl thing that mails me the contents of the page, and builds a 2nd web page with the 2nd form on it (hidden fields contain the data for the 2nd cgi script to follow).

what i want is BOTH cgi's to process (the first one, that i can edit - which mails me the contents of the page, and the 2nd one, which i CAN'T - that actually does the page itself)

i'm against using a scripting language solution, as that's not compatable on all browsers or is turned off for security reasons often...i'd like to do it on my end, and i think the best solution would be to start up lynx on my shell acct and process the second script from within the 1st one, and then dealing w/ the data.....


0
 
LVL 7

Expert Comment

by:faster
Comment Utility
If you have enough time, you can modify your 1st script such that it does not generate another html page for the 2nd script, rather, it directly connects to the 2nd host and send it the whole request using socket.  Actaully your script is acting as a browser.

This is not a simple approach of course.  You need to be familiar  with socket and http.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:tonysebion
Comment Utility
ummm, exactly, that's just what i said - now does anyone have an example of that :)
0
 
LVL 5

Accepted Solution

by:
icd earned 200 total points
Comment Utility
The answer I gave first does what you want.

Script 1. (your script) is modified so that it does not output any html itself.

If running on Windows NT (since you did not answer my query about the server) then you use the WinPerl::Internet module to send an http request to the URL of the second script. This will return the second page in a scalar variable which you can then print. I have a simple example of this which works.

If running UNIX then you need to write a socket program to connect to the URL of the second script. A little bit more complicated but the same principle as above.

The net (pun intentional) result is that the user clicks on a button on the first form, your script is run which runs the second script and the result of the second script is output to the user.
0
 
LVL 5

Expert Comment

by:icd
Comment Utility
I have found a script that although it does not do exactly what you want it will show you how to use sockets to retrieve a URL (i.e. run the second script). I will continue to look for other more immediately relevent scripts but you might want to look at.

http://sunhe.jinr.dubna.su/docs/webcopy.html
0
 
LVL 5

Expert Comment

by:icd
Comment Utility
An even better script to see socket programming in action is at:-

http://www.cfcl.com/tin/P/9606.nph-rover

0
 

Author Comment

by:tonysebion
Comment Utility
that 2nd one looks like just the thing i need...if i need additional help on this, i'll just ask another question....
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

762 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

8 Experts available now in Live!

Get 1:1 Help Now