User Control Panel
Advertisements

HELP US, HELP YOU!

Getting the filename of a web download?

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
Teario
Member
Member


Joined: 25 Jun 2004
Posts: 130
Location: Liverpool(home) or Derby(uni), UK
Reputation: 59.8
votes: 3

PostPosted: Mon Jul 03, 2006 8:17 pm    Post subject: Getting the filename of a web download? Reply with quote

I am trying to make a command that will send a random Msg+ Live! sound. My bot can send the sounds now, but there are lots and lots of sounds which are identified by their ID. You can download a random sound from the following site: http://sounds.msgpluslive.net/esnd/snd/random?catId=2

When you visit that site, it sends you a file, and the name of the file is the ID of the song. So what I need to do is not download the file, but see the filename that it is sent with. Is there a way I can do this? Ive looked at the LWP documentation on cpan and cant see anything that looks like it would let me do this.

Thanks Smile

Edit:
Its ok, ive solved it by doing the following:
Code:
require HTTP::Request;
my $request = HTTP::Request->new( GET => '<url here>' );
my $ua = LWP::UserAgent->new;
my $response = $ua->request( $request );

$response->{'_headers'}->header( '<header label>' ) );
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group