Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic CGI search engine

Status
Not open for further replies.

pedros007

Programmer
Nov 14, 2004
8
GB
Hello all,

I am very new to CGI scripting and perl. I have managed to create a perl program which searches through the URL that I have specified and extracts all of the URL's to a a specific extraction level which is chosen by the user.

What I would like to do, is incorporate CGI into this Perl code, Specifically that the user is presented with a html page, with a simple submit button on, which then executes the Perl code, which runs the script and then displays all of the results on another HTML page.

Please find included the code which I have prepared.

Any help would be greatly appreciated.

Kind Regards

Peter

#!usr/bin/perl

use LWP::Simple;

$url = "$content = "Google Search Engine";
$level = 2;
$regexp = "<a\s+.*?href\s*=\s*"(
$store[0] = $content;
$store[1] = $url;
$oldstoresize = 0;

for ($levelcounter=0; $levelcounter<=$level; $levelcounter++){
$newstoresize = @store;
for ($oldstoresize; $oldstoresize<$newstoresize; $oldstoresize+=2){
$temppage=get($store[$oldstoresize+1]) or die("Couldn't get page";
while ($temppage=~/$regexp/sig){
push (@store,$2,$1);
}
}
$oldstoresize = $newstoresize;
}
foreach (@store){
print $_."n";
}
 
This forum really isn't here to build/modify scripts for people, but to assist them with the problems they run into while making the necessary changes/additions. Give the changes you want to make a shot and if you get stuck, post to the forum again. We'd be happy to help you though specific difficulties.

- Rieekan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top