Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Search Engine Drop Down, form queried text with redirect

Posted on 1999-01-18
11
Medium Priority
?
287 Views
Last Modified: 2013-12-25
Hi,

I would like to put a drop down box on our site listing the search engines with their unique query strings as values.  The visitor would select the search engine they want, and then type their query request in a form field which is passed to a cgi script via an image button, which opens a new window without file, button, address or link menus. I would also like the form or cgi to write to a log file of the redirect and the search query, so I can see what our visitors are looking for when they leave the site.  I have found serveral examples which take up alot of real estate by listing all the search engines on a page with text fields.  This is NOT what I am looking for.  I have also found several redirect perl and cgi scripts which capture the information passed from a form...but I can't get it to work.  For an example, visit www.home.microsoft.com.  I can not run this in asp or on a IIs system.  It must be unix equiv.

Thank you very much,

Kevin
0
Comment
Question by:kpaulk
  • 7
  • 4
11 Comments
 
LVL 5

Expert Comment

by:thoellri
ID: 1832330
Kevin,

I suggest you give Perl and the WWW::Search Module a try. It offers a module-based front-end for several search engines and allows you to formulate a query independently of the back end (real search engine) you're using.
Have a start at: http://www.isi.edu/lsam/tools/autosearch/index.html and read about the WWW:Search module. I've used it before and I'm pleased with the performance of the module.

Let us know if you need more input.

Cheers
 Tobias


0
 

Author Comment

by:kpaulk
ID: 1832331
All,

I looked at the referenced page suggested by Tobias, and I have no idea what I looked at.  I would like to add that our site is remotely hosted at Mindspring.  Therefore I can not run a .exe file. I have nearly 100% cgi-bin access.  If your interested in seeing the page on our site that I am refering to please email me at k9p@mindspring.com.  Because the site is not ready, I am not ready to publish the addresss here.

Thank you for your response Tobias, its just not quite what I am looking for.

Respectfully Submitted,
Kevin Paulk
0
 

Author Comment

by:kpaulk
ID: 1832332
Edited text of question
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
LVL 5

Expert Comment

by:thoellri
ID: 1832333
Kevin,

I just looked at ww.mindspring.net and their site-hosting services. They run Sun Solaris as their OS on the servers and promise to give you "full access" to your CGI-scripts. If you can confirm that you're able to use "perl" scripts as cgi-scripts on their system, then I can forward you a framework for the task you're trying to accomplish.

Tobias

0
 

Author Comment

by:kpaulk
ID: 1832334
Tobias,

Most EXCELLENT!!! Yes, I am already running some perl and cgi scripts...on the mindspring servers
0
 
LVL 5

Expert Comment

by:thoellri
ID: 1832335
Kevin,

I just tried the following on my server and it seems to work just fine. Here come two parts you need: the HTML-fragment which creates the form (searcher.html) and the perlscript which queries the searchengines (searcher.pl):

SEARCHER.HTML:

<html>
<head>Search Engines</head>
<body>
<form action="searcher.pl">
<select name="searchengine">
<option selected value="AltaVista">AltaVista http://www.altavista.com
<option value="Lycos">Lycos http://www.lycos.com
<option value="WebCrawler">WebCrawler http://www.webcrawler.com
</select><br>
Search-String: <input type=text name="searchstring"><br>
<input type=submit value="search">
</form>
</body>
</html>


SEARCHER.PL:

#!/usr/local/bin/perl
use CGI;
use WWW::Search;

$query=new CGI;
if ($query->param('searchengine') && $query->param('searchstring')) {
   # at this point you can write the searchengine and searchstring selection
   # to a log-file of your choice.
   $search=new WWW::Search($query->param('searchengine'));
   $search->native_query(WWW::Search::escape_query($query->param('searchstring')));
   print $query->header(-target => '_blank');
   print $query->start_html(-title => "Search-results from ".$query->param('searchengine'));
   print "<h2>Searchstring: ".$query->param('searchstring')."</h2>\n";
   while ($result = $search->next_result()) {
             print "<a href=\"".$result->url."\">",$result->url,"<br>\n";
   };
   print $query->end_html;
}


And here is a quick explanation: searcher.html builds a form with a drop-down. The DropDown currently contains three popular search engines, but you can extend that. Make sure that the names of the "VALUE" fields correlate with the names of the Search Engine-backends in the perl-module WWW::Search.

After selecting a search-engine and selecting the searchstring the form-values are passed to the searcher.pl CGI-script (note: adjust action-value if you have to move the script to a different location!)
The script make use of some perl-modules which you have to download yourself! (WWW::Search and CGI)
The script gets the values for the search-engine and the searchstring from the form and creates a new WWW-Search object based on the users selection of a search engine. It then sends a query to the search-engine and waits for a response. It then creates a new HTML-document, where the -target is set to be a new window. For each result returned from the search engine it will print a URL and the user can click on the URL to go the result of the query.

There is no error-checking done (hey, its a quick hack). Read the WWW::Search documentation for more info.

Hope this helps
   Tobias

0
 

Author Comment

by:kpaulk
ID: 1832336
okay,

I created the html form and the searcher.pl script.  I will upload these shortly.  I also downloaded the WWW:search program. Now, what part of the program do I upload to my mindspring server?  All of it?

The instructions are as follows:

INSTALLATION
------------

In order to use this package you will need Perl version 5.002 or
better.  You install WWW::Search, as you would install any perl module
library, by running these commands:

    perl Makefile.PL
    make
    make test
    make install

See below for a description of what "make test" does.

If you want to install a private copy of WWW::Search in your home
directory, then you should try to produce the initial Makefile with
something like this command:

    perl Makefile.PL PREFIX=~/perl

I dont think I can run this on the mindspring machines. I don't have that kind of access.  Do I make these files locally or on the Mindspring servers?  NOW its getting difficult

Kevin
0
 

Author Comment

by:kpaulk
ID: 1832337
Thank you for your help Tobias.  You can close this question now.
0
 

Author Comment

by:kpaulk
ID: 1832338
Adjusted points to 450
0
 
LVL 5

Accepted Solution

by:
thoellri earned 1800 total points
ID: 1832339
Thanks for the points - but it's not running yet :-)

Tobias
0
 

Author Comment

by:kpaulk
ID: 1832340
Tobias,  

Thank you for all the work you did. I really appreciate it.

Kevin
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

783 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