Input a web page to a perl program 
Author Message
 Input a web page to a perl program


Quote:
> I want to read a web page into my perl program and give the content to a
> string variable $data
> For example:
> the url of the web page is: http://www.*-*-*.com/
> Can I use the read function for the input?

> eg.
> my ($data, $length, $chunk);
> my $file = ' http://www.*-*-*.com/ ';
> while ($chunk = read ($file, $data, 1024) {
>     print $data;
> }

> But, it seems that it doesn't work. The program doesn't know the url
> although I can use this way to upload a file from my computer. Can anyone
> tell me what I should do and what statements I should use?

Your need LWP, one of Perl's best features IMHO.
http://www.*-*-*.com/

gtoomey



Sun, 01 Aug 2004 11:00:53 GMT  
 Input a web page to a perl program

Quote:

>I want to read a web page into my perl program and give the content to a
>string variable $data

You are expected to check the Perl FAQs *before* posting
to the Perl newsgroup you know...

Quote:
>For example:
>the url of the web page is: http://www.xxxxx.com/index.htm
>Can I use the read function for the input?

No, of course not.

read() works on files.

A web page is not a file.

Quote:
>Can anyone
>tell me what I should do and what statements I should use?

We shouldn't need to tell you. The answer is already on your
very own hard disk. Just find it and read it:

   perldoc -q HTML

      "How do I fetch an HTML file?"

--
    Tad McClellan                          SGML consulting

    Fort Worth, Texas



Sun, 01 Aug 2004 14:35:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Code to personalize web page based on form field input

2. Inputting to file from web page

3. Perl Programs Serving Web Pages

4. Pub needs automated web page generator program

5. please help - cgi database access script / program for web page

6. how to compile a fortran program from web page

7. Looking for a Program to Produce Web Page from Humor Mail

8. Need a program to submit my web page to search engines

9. Free help for programming students web page

10. Programming related web page

11. Making a new web page out of an existing page

12. How to call a perl script or web page from within perl

 

 
Powered by phpBB® Forum Software