Solved

Embedding CGI Scripts

Posted on 2000-05-12
11
166 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
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 7

Accepted Solution

by:
nettrom earned 50 total points
Comment Utility
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
Comment Utility
agreed
0
 

Expert Comment

by:jwcs
Comment Utility
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
 
LVL 7

Expert Comment

by:nettrom
Comment Utility
jwcs, did you read the question?

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

Expert Comment

by:jwcs
Comment Utility
jwcs changed the proposed answer to a comment
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Expert Comment

by:jwcs
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

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

9 Experts available now in Live!

Get 1:1 Help Now