in reply to using LWP to download and save an mp3

Consider this the request to post your code. You don't show how you save the file. I recommend using the ->mirror() function of LWP::Simple to save files. Most likely you're missing a binmode call on the filehandle you're saving to.

Replies are listed 'Best First'.
Re^2: using LWP to download and save an mp3
by j3f (Novice) on Jan 16, 2009 at 21:16 UTC
    Here is the code that shows the way I was trying to save the file.I'll try using the function that you suggested and see if it solves my problem and I'm guessing that it will. Thanks
    #!/usr/bin/perl -w use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->agent('Mozilla/5.0'); my $req = HTTP::Request->new(GET => 'http://sight.com/action.php?id=u1 +VInM4D'); $req->content_type('audio/x-mpeg'); # Pass request to the user agent and get a response back my $res = $ua->request($req); # Check the outcome of the response if ($res->is_success) { open FH, ">file.mp3"; print FH $res->content; close FH; }