Gossamer Forum
Home : General : Perl Programming :

pulling results

Quote Reply
pulling results
I want to make a cgi script that will pull results from my search engine and display it on the website where the cgi script is installed and display the results on their page.
I've seen scripts like this that pull results from google etc. but how easy will it be to do this for my new search engine.


Quote Reply
Re: pulling results In reply to
How about........

#!/usr/bin/perl

use LWP::Simple;

&main();

sub main {
print "Content-type: text/html\n\n";
$url = "http://www.searchengine.com/cgi-bin/search.cgi?query=bla";
@data = get($url);

foreach (@data) {
print "$_\n";
}

}

That is the simplest form.

You can then pattern match to get rid of parts of the page you don't want.

....eg

last if ($_ =~ /Copyright Google/);

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/