The owners of this page have gone to some effort to ensure people are not screen scraping their page using a robot. This involves lots of javascript. Interestingly they have the equivalent of fatalsToBrowser enabled.

Here is one way to get the data by automating IE. This is only presented for interest and is a fragile solution. Use of such code may breach the cboe.com TOS/TOC. Usual suggestion is not to be a cheapskate and buy the data you want.

use Win32::IE::Mechanize; use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys); my $ticker = 'INTC'; my $time = time(); my $filename = "$ticker-$time.txt"; my $ie = Win32::IE::Mechanize->new( visible => 1 ); $ie->get( "http://www.cboe.com/DelayedQuote/QuoteTableDownload.aspx" ) +; if ( fork ) { $ie->form_name( "QuoteTableDownload" ); $ie->set_fields( ticker => $ticker ), $ie->click_button( value =>'Download' ); print "Closing IE\n"; $ie->close; } else { my $window; sleep 1 until ($window) = FindWindowLike(0, "^File Download" ); print "Got $window\n"; SetForegroundWindow($window); SendKeys("{TAB}~"); sleep 1; SendKeys("$filename~"); }

cheers

tachyon


In reply to Re: save file from POST form?? by tachyon
in thread save file from POST form?? by cwchang

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.