Solved

Embedding CGI Scripts

Posted on 2000-05-12
11
179 Views
Last Modified: 2013-11-18
I have a simple Perl CGI script that I need to embed into a web page.  I know you can use <IMG SRC="somefile.cgi">, but my CGI script returns text, not an image.  So what do I use to embed the script?

I would prefer a method that does not require SSI (server-side includes) but if I must use them, then I guess I'll live with it.

Thanks
0
Comment
Question by:Egore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 7

Accepted Solution

by:
nettrom earned 50 total points
ID: 2806660
You'll either have to use SSI, or make the CGI script output the whole page and then call it directly.

The SSI directive you're looking for is
'exec':

<!--#exec cgi="myscript.cgi" -->
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2806910
agreed
0
 

Expert Comment

by:jwcs
ID: 2806982
Hello,

You probably need to print a header from your Perl Script that says that it is an image.  Like this:

print "Content-type: image/gif\n\n";

Before you actually put the image.  Also, make sure that your CGI script is executing, not just having it's contents displayed (you may have to put it in a CGI bin).

Hope this helps!

Jonathan
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 7

Expert Comment

by:nettrom
ID: 2808036
jwcs, did you read the question?

"...but my CGI script returns text, not an image..."
0
 

Expert Comment

by:jwcs
ID: 2808260
jwcs changed the proposed answer to a comment
0
 

Expert Comment

by:jwcs
ID: 2808268
Sorry, I didn't read it right.  I thought you were getting at someting else.  Sorry!  Anyway, I can't really see any way around the problem besides SSI.  There are a couple of slightly clumsy "solutions":

1) Use FLY to create a GIF image that is returned.  There is a text printing directive for that.  (By the way, FLY is a program used to make automated GIF files from a list of directives/commands).

2) You could use something like PHP3 or ASP, where the script is written in to the page, and then it is executed as the page is served.

Hope this is better!

Jonathan
0
 
LVL 3

Expert Comment

by:fibdev
ID: 2808361
From what I've seen, your best solution is to use a cgi script to create the page and change the content as needed.  Just have your other pages reference the script and it will look like just another html page.
0
 
LVL 3

Author Comment

by:Egore
ID: 2809844
Unfortunately, ASP is not supported on the server I need to run this on.  Also, I'm generating a price list, outputting it as a GIF would be way too slow and cludgey.

- Alex
0
 
LVL 3

Author Comment

by:Egore
ID: 2809850
I had been told this by some other person on IRC and couldn't make it work, so I asked here.  I still can't get it to work (even though the server claims to be SSI capable and I've even read an SSI FAQ and did what it said...).  However, this must be the correct solution, so I'm giving full credit for it.

I've decided to try simply putting a comment in the HTML pages, then having a CGI script read in the HTML file and simply output it to the web, when it hits the tag it'll insert the dynamic data.

Thanks for the help,
Alex
0
 
LVL 7

Expert Comment

by:nettrom
ID: 2810133
The most common mistake is that the documents must end with .shtml for the parsing to be enabled (been there, done that... :)

Sorry to hear that you didn't get it to work though.
0
 

Expert Comment

by:jgore
ID: 3030998
Hmmm.....I have same problem.

Why not make your web page with frames.
This way you can have your regular HTML in main window and just
call the CGI in the smaller window and have it produce a mini
html page just for it's own data. Seems the easiest solution to me.

I think I'll try the SSI first. But if that doesn't work I'll just use frames.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Find out what you should include to make the best professional email signature for your organization.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

705 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