Dear all,

I am trying to download a PDF file from a web page.
I have used the following code:

use WWW::Mechanize; my $mech = WWW::Mechanize->new( autocheck => 1 ); $mech->agent_alias( 'Windows IE 6' ); $mech->get("https://ecf.nynd.uscourts.gov/doc1/12501815060?pdf_toggle_ +possible=1&de_seq_num=17732 85&caseid=29430&got_receipt=1"); $mech->form_name('GetPass'); $mech->field(login => "xxx"); #Username $mech->field(key => "xxx"); #Password $mech->click(); print $mech->content;
Following is the content printed:
<html><head><title>CM/ECF LIVE - U.S. District Court - NYND</title> <script language="javascript" src="/lib/dls_url.js"></script></head><b +ody BGCOLOR=F9F9F9 TEXT=000000 ><div id="cmecfMainContent"><input typ +e="hidden" id="cmecfMainContentScroll" value="0"><SCRIPT LANGUAGE="Ja +vaScript"> document.cookie="PacerUser=\"li093301258064693 aDlYK1Zk9Vo\"; path=/; +domain=.uscourts.gov;"; if ("PacerPref=receipt=Y; path=/ ; domain=.uscourts.gov".length > 0) { document.cookie="PacerPref=receipt=Y; path=/ ; domain=.uscourts.gov;"; } if ("PacerClient=\"\"; path=/ ; domain=.uscourts.gov".length > 0) { document.cookie="PacerClient=\"\"; path=/ ; domain=.uscourts.gov;"; } if ("ClientDesc=\"\"; path=/ ; domain=.uscourts.gov".length > 0) { document.cookie="ClientDesc=\"\"; path=/ ; domain=.uscourts.gov;"; } if ("https://ecf.nynd.uscourts.gov/doc1/12501815060?pdf_toggle_possibl +e=1&de_seq_num=17732 85&caseid=29430&got_receipt=1".length > 0) { location.assign("https://ecf.nynd.uscourts.gov/doc1/12501815060?pdf_to +ggle_possible=1&de_seq_num=17732 85&caseid=29430&got_receipt=1"); } </SCRIPT><SCRIPT LANGUAGE="JavaScript"> var IsForm = false; var FirstField; function SetFocus() { if(IsForm) { if(FirstField) { var ind = FirstField.indexOf('document.',0); if(ind == 0) { eval(FirstField); } else { var Code = "document.forms[0]."+FirstField+".focus();"; eval(Code); } } else { var Cnt = 0; while(document.forms[0].elements[Cnt] != null) { if(document.forms[0].elements[Cnt].type != "hidden") { document.forms[0].elements[Cnt].focus(); break; } Cnt += 1; } } } return(true); } </SCRIPT> </div></body></html>
However the actual page has a <iframe> tag within which the src attribute of tag has link to pdf.
id="cmecfMainContent"><input type="hidden" id="cmecfMainContentScroll" + value="0"> <iframe src="/cgi-bin/show_temp.pl?file=1086820-0-.pdf&type=applicatio +n/pdf" height="100%" width="100%" frameborder="0" scrolling="no"> <a href="/cgi-bin/show_temp.pl?file=1086820-0-.pdf&type=application/pd +f">click here to view this file</a> </iframe> </body></html>
I have tried using FramesReady and mechanize, but no success. Kindly suggest how to get the pdf link.
Any help would be appreciated.

Thank you


In reply to Perl iframe problem by tak_hot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.