I am having a hard time getting the syntax right to pull market statistic
info from the CBOE web site

Here is the URL

http://www.cboe.com/Common/PageViewer.asp?HEAD=Market+Statistics+Summary&SEC
=3&DIR=TTMDMarketStat&Calendar=1&Dy=12&Mo=2&Yr=2002

Here is my code snippet:



 

  # Create a user agent object
  use LWP::UserAgent;
  $ua = new LWP::UserAgent;
  $ua->agent("$0/0.1 " . $ua->agent);

  # Create a request
  $req = new HTTP::Request GET =>
'http://www.cboe.com/Common/PageViewer.asp?HEAD=%22Market+Statistics+Summary
%22&SEC=15&DIR=TTMDMarketStat&Calendar=1&Dy=6&Mo=2&Yr=2002';

  # Pass request to the user agent and get a response back
  $res = $ua->request($req);
  $aa = $res->as_string();
  $bb = $res->content();
  print "$aa\n";
  print "$bb\n";

  # Check the outcome of the response
  if ($res->is_success) {
      print $res->content;
  } else {
      print "Bad luck this time\n";
  }  
 


I get an error to the effect it doesn't like the header:

<h2>There was an error loading the header portion of the Viewer Page.</h2>

<p> An error has occurred. You may contact your system administrator with
the following information: </p>                                 
<p>Location : /Common/PageViewer.asp</p>                                
<p>Source : Microsoft VBScript runtime error</p>

<p>Code : 5</p>                                 
<p>Description : Invalid procedure call or argument</p> 


Any help would be greatly appreciated.  Thanks,
Barry Hall



Reply via email to