Solved

Search Engine Drop Down, form queried text with redirect

Posted on 1999-01-18
11
267 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
[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
  • 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

734 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