--- spamcopreporter.pl.orig Wed Oct 31 11:23:23 2001 +++ spamcopreporter.pl Thu Dec 27 11:59:12 2001 @@ -6,6 +6,7 @@ # Feed this script the emails from the SpamCop AutoResponder # # Written by Robert Jan Scheer in july 2001 +# Updated by Chris Hardie in Nov 2001 to work with paid Spamcop Membership # ############################################################################## @@ -34,8 +35,7 @@ my($version) = q$Revision: 1.6 $ =~ /(\d+\.\d+)/; # RCS revision control my $useragent = "SpamCopReporter/$version"; my $sendmail = "/usr/sbin/sendmail -t"; -my $maintainer = ''; # Against harvesters -my $baseurl = "http://spamcop.net/"; # Should end on / to be safe +my $maintainer = ''; # Against harvesters my $delimiter = "-" x 75 . "\n"; ############################################################################## @@ -74,9 +74,11 @@ htmldebug => 0, # Show HTML parsing debug httpdebug => 0, # Show HTTP requests pagedebug => 0, # Print HTML page that is being parsed - verbose => 0, # Give more info about what is happening + verbose => 1, # Give more info about what is happening checkall => 0, # Check all checkboxes in the HTML form background => 1,# Run program in background and mail results + authenticate => 0, # Provide credentials to SpamCop + baseurl => 'http://spamcop.net/' # Base URL with trailing slash ); ############################################################################## @@ -92,6 +94,7 @@ } } } +my $baseurl = $opt{baseurl}; # No filedebug unless you have a tty if ($opt{filedebug} and not -t) { @@ -181,7 +184,7 @@ my $page; - my $uri1 = URI::URL->new_abs($url, $baseurl); + my $uri1 = URI->new_abs($url, $baseurl); print "Getting ",$uri1->as_string,"\n" if $opt{verbose}; if ($page = GET($uri1)) { # Get first page (form) @@ -222,7 +225,7 @@ push @output, "" if @output; # Second page coming up - my $uri2 = URI::URL->new_abs($action, $baseurl); + my $uri2 = URI->new_abs($action, $baseurl); print "Submitting form data to ",$uri2->as_string,"\n" if $opt{verbose}; # Get second page (result) @@ -260,12 +263,14 @@ $uri->query($query); } my $req = HTTP::Request->new("GET", $uri); + $req->authorization_basic($opt{username}, $opt{password}) if $opt{authenticate}; return GETorPOST($req); } sub POST { # Create HTTP POST request my($uri, $query)= @_; my $req = HTTP::Request->new("POST", $uri); + $req->authorization_basic($opt{username}, $opt{password}) if $opt{authenticate}; $req->content_type('application/x-www-form-urlencoded'); $req->content($query); return GETorPOST($req);