Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Application and Web Development > All Other Coding Languages
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 09-07-2004, 10:39 PM   #1 (permalink)
gty
Registered User
 
Join Date: Sep 2004
Posts: 2
gty is on a distinguished road
{perl} HTTP Error Code Response

I need to be able to send http requests to a given server and have it respond with the error code of the page displayed. Something with a response like:

C:\> perl blah.pl host.com 80
Error Code: 404 (Page Not Found)

or

C:\> perl blah.pl host2.com 80
Error Code: 403 (Forbidden)

So I looked up info on the HTTP::Request class and tried

Code:
require HTTP::Request; $request = HTTP::Request->new(GET => 'http://www.host.com'); print $request;
but was responded with
Code:
HTTP::Request=HASH(0x1899864)
I'm a newbie when it comes to Perl but any ideas would be greatly appreciated.
__________________
gty is offline   Reply With Quote
Old 09-08-2004, 05:01 AM   #2 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
Typically HTTP::Request is used in conjunction with LWP::UserAgent or various other modules. I don't believe this module actually performs the request.

See the UserAgent module for an example:

http://search.cpan.org/~gaas/libwww-...P/UserAgent.pm

Or LWP::Simple:

http://search.cpan.org/~gaas/libwww-.../LWP/Simple.pm

-r
__________________
idx is offline   Reply With Quote
Old 09-08-2004, 11:09 AM   #3 (permalink)
gty
Registered User
 
Join Date: Sep 2004
Posts: 2
gty is on a distinguished road
Thanks idx, after my post I was looking around cpan and found a a couple more things to try as well HTTP::Status and LWP::Simple were tw oof them, so thanks again.
__________________
gty is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl elmore Perl 3 12-12-2006 07:49 PM
how come i dont hear much about perl Apodysophilia All Other Coding Languages 2 12-16-2003 10:05 AM
Is Perl obsolete or something? Epsilon Perl 13 06-15-2003 12:14 AM
Diffrent storage types in perl tin_man Perl 0 02-24-2003 01:55 PM
Hello World in perl tin_man Perl 0 02-24-2003 01:36 PM


All times are GMT -8. The time now is 09:33 PM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle