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";
}
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";
}