Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

To find the Title of current page

by Anonymous Monk
on May 23, 2016 at 08:52 UTC ( [id://1163848]=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks

I am using WWW::Mechanize module to extract hyperlinks and download a file from website

I have a small problem to identify the file name of the current page

$temp="https://www.ctslink.com/a/document.html?key=2988562"; $mech->get($temp); $mech->save_content();

The above mentioned url is a pdf file link and url has only key value there is no extension or file name, my question is how do i extract the pdf file name? even i used $mech->title() to get title but it seems a null string only

Any Idea...

Replies are listed 'Best First'.
Re: To find the Title of current page
by Corion (Patriarch) on May 23, 2016 at 08:54 UTC

    If the page sends a real filename, it will be in the Content-Disposition header of the response.

    Otherwise, there is no way to get at the title of a PDF file from within WWW::Mechanize. You will need one of the PDF modules to extract the metadata from a PDF file.

      Yeah Thanks it's work fine

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-25 20:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found