?
Solved

Embedding CGI Scripts

Posted on 2000-05-12
11
Medium Priority
?
180 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 200 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
Suggested Courses

777 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