CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
HTTP Request Header??

 



chitownclone
New User

Feb 24, 2005, 2:02 PM

Post #1 of 2 (966 views)
HTTP Request Header?? Can't Post

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
----------------------------------------------------------
*** Funcationality of: http://web-sniffer.net/***


MrPJ
User

Feb 24, 2005, 5:06 PM

Post #2 of 2 (963 views)
Re: [chitownclone] HTTP Request Header?? [In reply to] Can't Post

HTTP::Response provides a header() method to get/set headers from a request.

http://search.cpan.org/~gaas/libwww-perl/lib/HTTP/Response.pm

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives