View Full Version : Simple OPEN FILE will not display
mar2195
07-01-2005, 01:24 AM
This script will not display anything. I've tried a few things, but no
success.
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
$html = 'http://toolscart.com/cgi-bin/ebooks/?;;iu';
open(FILE, $html) || die "Could not open the file: $html";
@lines = <FILE>;
close(FILE);
print @lines;
exit(0);
Could it be because of the specific URL that I'm trying to open?
http://toolscart.com/cgi-bin/ebooks/?;;iu
If I use this exact script with a LOCAL file, it works just fine.
Hope someone can help.
Thanks.
FishMonger
07-01-2005, 01:37 AM
You can't retrieve a remote web page that way; open is used for opening a filehandle to a LOCAL file. You need to use LWP.
http://search.cpan.org/~gaas/libwww-perl-5.803/lib/LWP/Simple.pm
#!/usr/bin/perl -w
use strict;
use LWP::Simple;
my $html = 'http://toolscart.com/cgi-bin/ebooks/?;;iu';
getprint($html);
mar2195
07-01-2005, 02:16 AM
First of all THANK YOU FishMonger!!!!
(*I did have to add:
print "Content-Type: text/html\n\n";
to get the HTML to display -- no problem.)
One more question...
If I want to alter some HTML tag info in this page before it is displayed, what would be the best way to go about this?
Example:
I'd like to change all of the font sizes in this page to smaller font sizes.
<font size="5">
to
<font size="3">
(and some other HTML changes)
Thanks.
FishMonger
07-01-2005, 02:29 AM
Before I give you more help in ripping off someone else's web pages, maybe you should get thier approval.
mar2195
07-01-2005, 02:38 AM
:)
I completely understand your concern.
Unfortunately, the scenerio is exactly the opposite.
According to this company, I am supposed to embed this site's "store" HTML within my HTML/CGI. However, they no nothing about HTML or coding. They said that if I can alter their code to match my site, that would be up to me. So I will be adding my header & footer and then insert their HTML in the middle. This is also part of the reason that I have to edit their HTML. If you VIEW SOURCE in their page, you'll see that their HTML is not "pretty". It even has two "<html> sections.... which obviously, I would like to delete... if I'm going to use their page as the middle of my page, the last thing that I need is a third <html> section.
So I have no intentions of altering their "site", but merely make adjusts to mirror my design.
Thanks.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.