Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Read limited size of HTTP content

Reply
Thread Tools

Read limited size of HTTP content

 
 
Great Deals
Guest
Posts: n/a
 
      10-01-2003
I am trying to stream a real-time stock quote from a none stream http
html page. The real-time stock quote info is at the some part of the
page. I only want to download this part not other content. I am very
sure that http protocal can do this, because such programs as
net-transport, net-ant, flash-get.. all can resume download broken
files. I checked their http header from those download manager.
Besically they just telling the server it is a partial download and
tells the server the starting point of the download, and it can ends
at certain point.

I can not find any PERL module doing this. I think the most low level
http is Net::Http, but I still could not find anything there that
meets my need. Here is the code copied from Net::HTTP

use Net::HTTP;
my $s = Net::HTTP->new(Host => "www.perl.com) || die $@;
$s->write_request(GET => "/", 'User-Agent' => "Mozilla/5.0");
my($code, $mess, %h) = $s->read_response_headers;
while (1) {
my $buf;
my $n = $s->read_entity_body($buf, 1024);
die "read failed: $!" unless defined $n;
last unless $n;
print $buf;
}

It looks like $s->read_entity_body($buf, 1024); is close, but it does
not specify the starting point and ending point. Another question how
do I exit from the while loop if the maxsize is read. They use die,
will die quit the whole perl program? Should I use exit instead here?
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP SOAP/HTTP GET/HTTP POST milan_9211 Software 0 01-10-2011 02:10 PM
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
How do I manipulate the scroll bars so that a div with content thatchanges size shows the content at the same location? Shauniwthanau Javascript 1 03-25-2010 01:55 PM
limited connectivity for limited users =?Utf-8?B?aG9yc2VmbHk=?= Wireless Networking 1 03-24-2006 05:17 PM
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">? TheKeith HTML 20 10-29-2003 11:56 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57