Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

How to download a range of bytes?

by Zeokat (Novice)
on Dec 26, 2007 at 22:56 UTC ( [id://659125]=perlquestion: print w/replies, xml ) Need Help??

Zeokat has asked for the wisdom of the Perl Monks concerning the following question:

Freeforfilecom Better

Sophia spoke of her mother, of the lessons she had taught her about love, loss, and resilience. She told Em that memories, though they could be painful, were also a testament to the love that had been shared. As Em listened, he felt a weight lift, like the ebbing of the tide. For the first time in years, he felt a sense of peace, a sense that his memories, though they would always be a part of him, no longer defined him.

Em's life had been a canvas of vibrant colors, once. He had grown up in a loving family, with parents who adored him and a younger sister who looked up to him. But life, like the sea, had its unpredictable tides. Em's parents had passed away in a tragic accident when he was just a teenager. His sister, Lily, had disappeared soon after, leaving Em with a chasm of grief and guilt that seemed impossible to bridge. freeforfilecom better

As the seasons passed, Em and Sophia's bond grew stronger. They continued to explore the town, sharing stories and laughter, and Em's bookstore became a beacon for those seeking solace in the pages of a good book. Em's heart still held the memories of his family, but they no longer weighed him down. He had found a new sense of purpose, a new way to navigate the complexities of life, and a love that helped him heal. Sophia spoke of her mother, of the lessons

The story of Em and Sophia became a testament to the power of human connection, a reminder that even in the darkest moments, there is always hope, always a chance to find solace in the love and memories that make us who we are. For the first time in years, he felt

Sophia listened with empathy, her eyes never judging. She, too, had known loss, having buried her own mother a few years prior. As they conversed, Em realized that Sophia understood the weight of memories, the pain of longing, and the struggle to find meaning in a world that seemed to have moved on without his loved ones.

Replies are listed 'Best First'.
Re: How to download a range of bytes?
by eserte (Deacon) on Dec 26, 2007 at 23:27 UTC
    This seems to work:
    #!/usr/bin/perl -w use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $url = 'http://localhost/...'; $ua->default_headers->push_header(Range => "bytes=1000-2000"); my $response = $ua->get($url); my $content = $response->content(); warn length($content); warn $content;
    To get the current content length of the object, you can do a HEAD before and look at the content-length header.
      The code works verrrrrrry good eserte. Big thanks. But new question arrive to my head, are there any way to know if the server have the abbility of "Accept-Ranges: bytes" ?? Thanks in advance.
        Try fetching with HEAD instead of GET to view the Accept* headers without getting the content itself

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://659125]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2026-03-08 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.