#!/usr/bin/perl
# ==============================================================================
# Gossamer Threads Remote Search for Links SQL
# http://www.gossamer-threads.com/
# Copyright (c) 2002 Gossamer Threads Inc. All Rights Reserved.
# ==============================================================================
#
# Server Requirements:
# - You must have LWP module installed, and the XML_Results plugin installed on
# the Links SQL installation.
#
# Installation Instructions:
# - Edit the $url below to point to the server you wish to get your results from.
# - Edit the search_results.htm template to format it the way you like. NOTE: This
# is NOT parsed by GT::Template, and you can use only normal template tags, there
# is no support for if's, functions, etc.
# - Upload this file, and search_results.htm in ASCII mode, and place them
# in a directory that can run cgi's.
# - chmod 755 remote_search.cgi.
#
use strict;
use vars qw/$TEMPLATE $URL/;
use CGI;
$TEMPLATE = "search_results.htm";
$URL = "http://gossamer-threads.com/perl/links-sql2/search.cgi?xml_feed=1";
main();
sub main {
# -----------------------------------------------------------------------------
my $q = new CGI;
my $query = $q->param('query');
$query =~ s/([^\w.-])/sprintf("%%%02X",ord($1))/ge;
print $q->header;
$q->param or return print "No search term entered.";
eval {
require LWP::Simple;
import LWP::Simple;
};
if ($@) {
return print "You must have LWP::Simple installed in order to use this script.";
}
my $content = get("$URL&query=$query") or return print "Unable to load $URL. Reason: $!";
my $item_count = 0;
my $link_results_loop;
while ($content =~ m,