#!/usr/bin/perl use warnings; use IO::Socket; $somedir = $ARGV[0]; opendir DH, $somedir or die "Cannot open $somedir: $!"; my @files = grep { !-d } readdir DH; closedir DH; foreach $word (@files) { $flag = 0; $safecou = 0; $warcou = 0; @split = split( / /, $word ); $join = join( '+', @split ); $getexp = IO::Socket::INET->new( PeerAddr => 'www.riaaradar.com', PeerPort => '80', Proto => 'tcp', Timeout => '100' ) || print "Error: Connection\n"; print $getexp "GET /search.asp?searchtype=ArtistSearch&keyword=$join HTTP/1.0\n"; print $getexp "Host: www.riaaradar.com\n\n"; while ( $exp = <$getexp> ) { if ( $exp =~ m/No results were found/ ) { $flag = 1; } #print "Artist: $1\n" if $exp =~ m/name="artist" value="(.*?)" \/>/; #print "Album: $1\n" if $exp =~ m/name="album" value="(.*?)" \/>/; #print "Result: $1\n\n" if $exp =~ m/name="result" value="(.*?)" \/>/; if ( $exp =~ m/name="result" value="Warning" \/>/ ) { $warcou += 1; } elsif ( $exp =~ m/name="result" value="Safe" \/>/ ) { $safecou += 1; } } print "$word -- Safe: $safecou Warning: $warcou\n" if $flag != 1; }