There is almost certainly a way to do it, since wget (et al) can be instructed to continue.
Personally, I can't find a single relevant option in LWP, LWP::UserAgent, HTTP::Request, HTTP::Headers, and more.
I'm very curious to see how how you would get a selected portion of a file with LWP. Someone will know.
UPDATE #1: Further investigation has revealed that you can set a "range" header with
$request_object->header( $field => $value ); but I haven't yet worked out the particulars of the header.
use strict; use LWP::UserAgent; use HTTP::Request; my $ua = LWP::UserAgent->new(); my $req1 = HTTP::Request->new(GET => $your_URL); $req1->header( Range => 'bytes=0-499' ); # bytes 0 through 499 my $req2 = HTTP::Request->new(GET => $your_URL); $req2->header( Range => 'bytes=500-' ); # bytes 500 onward my $res1 = $ua->request( $req1 => "file1.html" ); my $res2 = $ua->request( $req2 => "file2.html" ); # A byte range operation MAY specify a single range of bytes, or a set + of ranges within a # # ranges-specifier = byte-ranges-specifier # byte-ranges-specifier = bytes-unit "=" byte-range-set # byte-range-set = 1#( byte-range-spec | suffix-byte-range-spec + ) # byte-range-spec = first-byte-pos "-" [last-byte-pos] # first-byte-pos = 1*DIGIT # last-byte-pos = 1*DIGIT
-Paul
In reply to Re: How to read just part of a url's content
by jettero
in thread How to read just part of a url's content
by no_germs
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |