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
Solved

Embedding CGI Scripts

Posted on 2000-05-12
11
175 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
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

766 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