Solved

Writing a Search CGI running on a local host

Posted on 2002-05-28
16
330 Views
Last Modified: 2013-12-25
I would like some pointers on how to write a search CGI running on a local host, meaning searching in a folder of HTML files on my computer.

I especially need help in how to build the local host server and how to call the search CGI running from it.
The other point I am not sure about is how I return the results back to my browser.
0
Comment
Question by:barakp
[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
  • 7
  • 6
16 Comments
 
LVL 10

Expert Comment

by:rj2
ID: 7042366
You should install web server (e.g Apache),install Perl and save you CGI script in cgi-bin directory.
If you have configured web server correctly, you should be able to access cgi script like http://localhost/cgi-bin/myscript.pl

Here are some links:
Apache web server: http://www.apache.org
Activstate Perl: http://www.activestate.com/Products/ActivePerl/

Below is sample cgi script that returns "hello world" in browser.


#!/usr/bin/perl
use strict;

print "Content-Type: text/html\n\n";
print "<HTML><BODY>Hello world</BODY></HTML>";
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7042531
would you realy re-envent the wheel? There exist http://www.htdig.org/
0
 
LVL 1

Author Comment

by:barakp
ID: 7043090
I don't really understand how to configure the server.

Furthermore, I would like to note the machine the search will be done from will be Windows based.

Thanks for what you wrote so far it is great.
0
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!

 
LVL 1

Author Comment

by:barakp
ID: 7043095
Meaning the server needs to run from a Window's based machine.
0
 
LVL 10

Expert Comment

by:rj2
ID: 7044792
Well, for a basic setup I don't think you have to configure anything.
What Windows version do you have (95/98/ME/NT/2000/XP) ?

Please follow instructions below to get started.

Here is link to Windows version of Apache
http://apache.archive.sunet.se/dist/httpd/binaries/win32/apache_2.0.36-win32-x86-no_ssl.msi

Download it and install it.

Then download and install Perl.
http://www.activestate.com/Products/ActivePerl/

Test your web server by clicking this url
http://localhost

You should get a welcome message from Apache.

Then save the "hello world" cgi script above as "myscript.pl" under the cgi-bin directory where you installed Apache.

Then click on link below
http://localhost/cgi-bin/myscript.pl

0
 
LVL 1

Author Comment

by:barakp
ID: 7046785
I need this website to be distributed via CD-ROM. Does the server need to be installed in every computer or it be installed on the CD?
0
 
LVL 10

Expert Comment

by:rj2
ID: 7047411
CGI scripts need a web server to run, yes.
If what you want to do here is to distribute some html information with a search engine on CD-rom then IMHO it makes more sense to make the search engine in Java than to make it as a CGI script.
0
 
LVL 1

Author Comment

by:barakp
ID: 7047641
Do you mean a Java application or Java applet?

I would like to search via a web browser interface.
0
 
LVL 10

Expert Comment

by:rj2
ID: 7048768
You could write the search engine as a Java application that you could access through a web browser interface. The Java application would need to speak http for this to work.

I suggest Java because it has excellent network support, is platform independent and most users will already have Java support installed, but it is possible to use other languages too, including Perl.

Do you know something about the users that will use the CD-rom, is it a closed, small group or could it be anybody?
Can you assume something about which OS they use?
0
 
LVL 1

Author Comment

by:barakp
ID: 7049321
It's a group of 30 people using some sort of Windows OS.

Can a Java application be called upon from a web browser?
0
 
LVL 10

Expert Comment

by:rj2
ID: 7049336
Yes, if the Java aplications listens on some port (e.g. 6020), you can access it from web browser like http://localhost:6020
The Java application would need to written as a miniature web server.

Will the CD-ROM users be willing to install a web server and Perl in order to use the CD-ROM?

If yes, writing a CGI script is probably less work than writing a Java application.
If no, or if you plan wider distribution later, a Java application means less installation headaches for the users.
0
 
LVL 1

Author Comment

by:barakp
ID: 7049337
Can you explain to me how I get the Java application to listen to a port?
0
 
LVL 10

Accepted Solution

by:
rj2 earned 200 total points
ID: 7049617
Here is a link that should get you started.

http://www.advisor.com/Articles.nsf/aid/KUCHP001

0
 
LVL 1

Author Comment

by:barakp
ID: 7052023
The site looks great. Give me some time to check it out.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
How can I save all open docs into a given folder 12 128
How can i open a .fxp file 3 54
BATCH to EXE Converter 2 72
New-MoveRequest Exchange 2010 Powershell 1 42
Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

697 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