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
Old 09-07-2004, 11: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, 06: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, 12:09 PM   #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

Bookmarks

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

BB 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
how come i dont hear much about perl Apodysophilia All Other Coding Languages 2 12-16-2003 11:05 AM


All times are GMT -8. The time now is 11:49 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting