test whether or not a web page work

B

Bing Du

Greetings,

How can I test if a web page (e.g. http://www.cpan.org) works or not in
a Perl script? If it returns normal contents, it's working fine. If it
gives errors (500, etc.), then it has some problems. The results are
obvious in browser. Just wondering how to do that outside of web browsers.

Thanks in advance for any help,

Bing
 
G

gnari

Bing Du said:
Greetings,

How can I test if a web page (e.g. http://www.cpan.org) works or not in
a Perl script? If it returns normal contents, it's working fine. If it
gives errors (500, etc.), then it has some problems. The results are
obvious in browser. Just wondering how to do that outside of web browsers.

Thanks in advance for any help,

perldoc LWP::Simple
perldoc LWP

gnari
 
S

Sherm Pendley

Bing said:
How can I test if a web page (e.g. http://www.cpan.org) works or not in
a Perl script? If it returns normal contents, it's working fine. If it
gives errors (500, etc.), then it has some problems.

Have a look at the LWP::UserAgent and/or LWP::Simple modules on CPAN. The
first is more flexible and powerful, while the second is (as its name
implies) a simpler but less flexible alternative.

sherm--
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top