
Debz
Deleted
Mar 7, 2000, 7:12 AM
Post #1 of 2
(360 views)
|
|
Help with CGI Pleeezzz!
|
Can't Post
|
|
CGI GRABBER Please, is there anyone out there that will give me better instructions for this? Or even give me one that will accomplish the same thing this one describes? I really am desperate to find help. I have been searching for 4 days straight now. I only know a little CGI but I hope to get a lot better soon. I am enrolled for classes at the local Community College for next quarter (but I really need this now!) I want to give up-to-date local news, stocks, weather and other info to my viewers. I have found this script but the directions are unclear to me. Can anyone tell me how to configure the settings to go to www.heraldnet.com? If you would please explain in detail so I can relate your instructions to with more of the same. THANKS, Debz P.S. Disregard the (#) marks, they were from my email. I hope they donŐt make matters worse than they already are!!! #!/user/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 = "newshub.com/world"; #$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.newshub.com/cgibin; $numheads 15; # Number of headlines you want to be printed Times Three! $footer Search Results by newshub.com"; $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; ______________________________________ THE READ ME FILE Website News Grabber V 1.0! -- Copyright 1999 Jim Fletcher- - jim@fletcher.net - - http://jim.fletcher.net - This script is designed to put headlines on your websites. It has many variables to let you customize the information. The example grabs headlines and other information from NewsHub.com. Understanding the variables: Breakup Values: I have built in three "Breakup values". When the script visits the webpage you tell it to, it will read each line of the webpage. If the line has any of the "Breakup values", then it will print that line. By finding sufficiently "unique" Breakup strings (these are strings that only the lines you want contain), then only the data you want will be printed. I built in the possibility of having three criteria. If you want to add more, feel free by modifying the script with more "elsif" statements. If you don't need the 2nd or 3rd criteria, set them to some totally random string that couldn't possibly be in the webpage, but DON'T LEAVE THEM BLANK! Replace Values: If the website has used relative links & you want to make these hard links, then follow the example to see how to change the relative link to a hard link. Num Heads: This is the total number of "Headlines" that you want. I set this to the number of headlines I want, mul
|