Solved

Search Engine Drop Down, form queried text with redirect

Posted on 1999-01-18
11
249 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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 450 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to dynamically set the form action using jQuery.

705 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

19 Experts available now in Live!

Get 1:1 Help Now