1 #!/usr/local/bin/perl -w 2 # Copyright (C) 1998 Edward Piou, piou@ahref.com. 3 # Originally written for use on Anchor [ahref.com], 5/20/1998. 4 # This program is free software; you can redistribute it and/or 5 # modify it under the terms of the GNU General Public License 6 # as published by the Free Software Foundation; either version 2 7 # of the License, or (at your option) any later version. 8 use CGI; 9 use LWP::UserAgent; 10 use HTTP::Request; 11 use HTTP::Status; 12 13 $| = 1; 14 15 $cgi = new CGI; 16 print $cgi->header; 17 $input_url = $cgi->param('input_url'); 18 $input_email = $cgi->param('input_email'); 19 20 my $our_ip = "205.177.109.84"; 21 $HEADER = "/documentpath/header.inc"; 22 $FOOTER = "/documentpath/footer.inc"; 23 24 if ($input_url !~ /^http:\/\//) { 25 $output_string = "
"; 27 &show_output ($output_string); 28 exit; 29 } 30 if ($input_email !~ /@/) { 31 $output_string = "Invalid URL
\n"; 26 $output_string .= "You input an invalid URL - try again!
"; 33 &show_output ($output_string); 34 exit; 35 } 36 37 @site_list = qw (altavista excite hotbot lycos webcrawler); 38 39 $altavista{"submission_page"} = "http://add-url.altavista.digital.com/cgi-bin/newurl"; 40 $altavista{"success"} = "has been recorded by our robot"; 41 $altavista{"q"} = "$input_url"; 42 $altavista{"ad"} = "1"; 43 44 $excite{"submission_page"} = "http://www.excite.com/cgi/add_url.cgi"; 45 $excite{"success"} = "Thank you!"; 46 $excite{"url"} = "$input_url"; 47 $excite{"email"} = "$input_email"; 48 $excite{"look"} = "excite"; 49 50 $hotbot{"submission_page"} = "http://www.hotbot.com/addurl.html"; 51 $hotbot{"success"} = "Got it!"; 52 $hotbot{"newurl"} = "$input_url"; 53 $hotbot{"email"} = "$input_email"; 54 $hotbot{"ip"} = "$our_ip"; 55 $hotbot{"redirect"} = "http://www.hotbot.com/addurl2.html"; 56 57 $lycos{"submission_page"} = "http://www.lycos.com/cgi-bin/spider_now.pl"; 58 $lycos{"success"} = "We successfully spidered your page."; 59 $lycos{"query"} = "$input_url"; 60 $lycos{"email"} = "$input_email"; 61 62 $webcrawler{"submission_page"} = "http://webcrawler.com/cgi-bin/addURL.cgi"; 63 $webcrawler{"success"} = "has been scheduled for indexing."; 64 $webcrawler{"url"} = "$input_url"; 65 $webcrawler{"action"} = "add"; 66 67 my $ua = new LWP::UserAgent; 68 $ua->agent ("ahref.com multisubmit 1.0"); 69 $ua->from ("piou\@ahref.com"); 70 $ua->timeout (90); 71 72 $output_string = "Invalid Email Address
\n"; 32 $output_string .= "You input an invalid email address - try again!
"; 73 $output_string .= "Anchor > Guides > "; 74 $output_string .= "Industry > "; 75 $output_string .= "Planting Seeds in All the Right Places\n"; 76 $output_string .= ""; 102 &show_output ($output_string); 103 exit; 104 105 sub show_output { 106 my $output_string = shift (@_); 107 open HEADER or die "Can't find file $HEADER: $!\n"; 108 while (\n"; 78 $output_string .= "
\nSite Submitter Results
\n"; 79 80 foreach $sitename (@site_list) { 81 $query_string = $$sitename{submission_page} . "?"; 82 foreach $key (keys %$sitename) { 83 if (($key ne "submission_page") && ($key ne "success")){ 84 $query_string .= "$key=$$sitename{$key}&"; 85 } 86 } 87 my $request = new HTTP::Request 'POST', $query_string; 88 my $response = $ua->request ($request); 89 $response_body = $response->content(); 90 if (($response->code() == RC_OK) && ($response_body =~ /$$sitename{"success"}/)) { 91 $output_string .= "
Submission to $sitename was successful.\n
\n"; 92 } 93 else { 94 $coder = $response->code(); 95 $output_string .= "
Submission to $sitename failed for some reason. "; 96 $output_string .= "(Response code $coder.) "; 97 $output_string .= "You will need to submit to $sitename by hand.\n
\n"; 98 } 99 } 100 101 $output_string .= "