| |
#!/usr/bin/perl
###############################
# NewsGrabber v. 1.0 #
# - SSI Version #
# Written by: Jim Fletcher #
# http://jim.fletcher.net #
# jim@fletcher.net #
# Use program at your own #
# risk, and ask before you #
# use someone's copyrighted #
# information on your site. #
# You may not redistribute, #
# sell, use for derivative #
# works which you then sell, #
# distribute or assume any #
# rights. #
###############################
use English;
use CGI;
use integer;
require LWP::UserAgent;
#####################
# #
# Parse Form Inputs #
# #
#####################
$q = new CGI;
#print $q->header;
$mytest =$q->param(mytest);
#####################
$ssi = "no";
$ua = new LWP::UserAgent;
$the_cgi = CGI->new;
$domain = "www.newshub.com/cgibin/search.cgi?keywords=printer+%22print+industry%22+printing+binder+%22full+color%22+%22full+colour%22+%22web+offset%22+Flexography+prepress+komori+heidelberg+prepress+%22sheet+fed%22+CTP+PDF+postscript+ICC+CMYK+agfa+kodak+adobe+%22quark+express%22+fonts+trutype+purup+preps+%22scenic+soft%22+pagemaker+photoshop+%22digital+marketing%22+pulp+%22paper+price%22+offset+scitex+drupa+corel+Konica+%22digital+image%22+indigo+%22pre-press%22+postpress+%22post-press%22+&match_headline=1&category=tech&category=financial&category=pr-tech";
#$domain = $ENV{'QUERY_STRING'}; # ex. "script.cgi?yahoo.com";
$begin = "http://";
$data = $begin . $domain;
$breakupa = ""; # If this string is in a line, that line will be printed.
$breakupb = "a0"; # If this string is in a line, that line will be printed.
$breakupc = "40"; # If this string is in a line, that line will be printed.
$replacea = "/cgibin";
$replaceb = "http://www.teamprinting.com/cgi-bin/stats/ax.cgi?http://www.newshub.com/cgibin";
$numheads = "600"; # Number of headlines you want to be printed Times Three!
$footer = " ";
$lookup = new HTTP::Request 'GET', "$data";
$response = $ua->request($lookup);
@lines = split (/\n/, $response->content);
if ($ssi eq "no")
{
print "Content-type: text/html\n\n";
}
print $mytest;
$i = 0;
foreach $line (@lines)
{
if ($line =~ /$breakupa/ && $i < $numheads)
{
$line =~ s/$replacea/$replaceb/;
print $line;
$i += 1;
}
elsif ($line =~ /$breakupb/ && $i < $numheads)
{
print $line;
$i += 1;
}
elsif ($line =~ /$breakupc/ && $i < $numheads)
{
print $line;
$i += 1;
}
}
print $footer;
exit; |