Getting CGI Output

Question:
Using C or C++ for CGI programs, is there a way to make a CGI program that calls another CGI program, and then takes the output of that called CGI program, and displays (to the client only) some selected text from the output of the called CGI program? For example, A CGI program that can use the Yahoo CGI program to display to the user only the first search result of a Yahoo search.

Answer:
A CGI program is a process, and as such, it has a distinct address space. Therefore, you can’t pass values directly from one CGI program to another unless you use some sort of interprocess communication (IPC), such as, sockets, shared memory or pipes. However, you can avoid the hassles of IPC by writing the results of the first CGI program into a file and then have its caller read the data from that file, filter it, and display it to the user.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: