×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

HTTP::Headers Issue

HTTP::Headers Issue

HTTP::Headers Issue

(OP)

I want to use HTTP::Headers to pull down server-side data (see bottom of page) for the sites I am contacting with HTTP::Request GET.

My 'Request' variables are returning the right values, but the my 'Headers' variables are null. I am pretty sure its something simple in my syntax, but can't figure it out. What's the correct syntax when using requesting header data?

Thank you very much for the help.

----------------------------------------------------------
#!/usr/bin/perl -w
use LWP::Simple;
use HTTP::Request;
use HTTP::Response;
use LWP::UserAgent;
use HTTP::Headers;
Net::Ping;

$url = "http\:\/\/www.mysite.com";

$robot = new LWP::UserAgent;
$robot->timeout (10);
$request = new HTTP::Request GET =>  $url;
$response = $robot->request( $request );
@content = $response->content . "\n";
$type = $response->content_type  . "\n";


require HTTP::Headers;  ????
$h = new HTTP::Headers; ????
$response = $robot->request( $request );   ????
$date = $h->date( $request );      ????
$server = $h->server( $request );  ????
----------------------------------------------------------

Connect to 198.xx.xx.xx on port 80
HEAD / HTTP/1.0
Host: www.mysite.com
Connection: close
Accept-Encoding: gzip
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*
Accept-Language: en-us
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705) Web-Sniffer/1.0.20
Referer: http://web-sniffer.net/
----------------------------------------------------------

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close