Viewing HTML source from URL

J

Julia De Silva

Hi there all,

Is it possible to view/process HTML source from an URL ?

my $html_file = 'http://www.mydomain.com/index.htm';
open(HTML, "$html_file") or die "$!";
while (<HTML>) { print; }
close(HTML) or die "$!";

The above doesn't find the file or directory which I suppose makes sense

my $html_file = '/path/to/document/index.htm';
open(HTML, "$html_file") or die "$!";
while (<HTML>) { print; }
close(HTML) or die "$!";

The above works OK but is not what I wanted !

Thanks in advance for help

J
 
J

Julia De Silva

Is it possible to view/process HTML source from an URL ?
my $html_file = 'http://www.mydomain.com/index.htm';
open(HTML, "$html_file") or die "$!";
while (<HTML>) { print; }
close(HTML) or die "$!";

The above doesn't find the file or directory which I suppose makes sense

my $html_file = '/path/to/document/index.htm';
open(HTML, "$html_file") or die "$!";
while (<HTML>) { print; }
close(HTML) or die "$!";

The above works OK but is not what I wanted !


Before the flames, please ignore this post .... I've at last found the FAQ
for this !!
Half the trouble is asking the right question !

J
 
L

Lars Eighner

In our last episode,
the lovely and said:
Hi there all,
Is it possible to view/process HTML source from an URL ?

Use the get function in LWP::simple. If you don't have LWP
installed and don't want to install, you can backtick whatever
fetch utility you have on your system or whatever browser with
appropriate flags (`lynx -source http://whatever`).
my $html_file = 'http://www.mydomain.com/index.htm';
open(HTML, "$html_file") or die "$!";
while (<HTML>) { print; }
close(HTML) or die "$!";
The above doesn't find the file or directory which I suppose makes sense
my $html_file = '/path/to/document/index.htm';
open(HTML, "$html_file") or die "$!";
while (<HTML>) { print; }
close(HTML) or die "$!";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top