Click to See Complete Forum and Search --> : Reading file from another website?


druss
03-23-2003, 01:30 AM
What i want to do is able to read a html file from a given url and then read and print it.

so far ive got this:

----------------------------------------------------------------
print "Content-type: text/html\n\n";

open(code,"http://www.yahoo.com/index.html");
@code = <code>;
close(code);

print "@code";
exit;
-----------------------------------------------------------------

Just a blank screen shows up??

Thanks
Goran

Nedals
03-23-2003, 01:39 AM
print "Content-type: text/html\n\n";

open(FIL,"http://www.yahoo.com/index.html");
@code = <FIL>;
close(FIL);

print "@code";
exit;

I've never done what you are doing, but you don't want to use the same name for your file handle (now FIL) as your variable (@code).

jeffmott
03-23-2003, 06:29 PM
They way it should be done is thisuse LWP::Simple;

print "Content-Type: text/html\n\n";
print get('http://www.site.com/path/page.html');Though other people have had trouble implementing this on their server. Hopefully it will work for you.