Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Determining Content-Length when there is no Content-Length header

by hacker (Priest)
on Sep 30, 2007 at 00:24 UTC ( #641735=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
       my $req         = HTTP::Request->new(HEAD => $url);   
       my $resp        = $ua->request($req);
       my $type        = $resp->header('Content-Type');
       my $content     = $resp->content;   
       my $content_len = $resp->header('Content-Length');   
    
  2. or download this
       my $req         = HTTP::Request->new(GET => $url); 
       my $content     = $resp->content;
       my $content_len = length($content);
    
  3. or download this
       my $req         = HTTP::Request->new(HEAD => $pl_url);
       my $resp        = $ua->request($req);
    ...
           $content     = $resp->content;  
           $content_len = length($content);
       }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://641735]
Approved by calin
help
Chatterbox?
[virtualsue]: 2 people - woot
[virtualsue]: an exclusive club
marto waves
choroba sees 5

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2018-04-24 10:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?