foreach $line (<STK>) { ($stock) = split(/ /, $line); $hist = `curl -s "http://ichart.finance.yahoo.com/table.csv?s=$stock +&a=3&b=12&c=2008&d=8&e=5&f=2009&g=d&ignore=.csv" | grep -v Date `; }

I am trying to use download history data from Yahoo!Finance by passing parameters to a url, e.g, starting date and ending date parameters.

In the above code, the expected result is stock data from 03/12/2008 to 08/05/2009. But the actual data returned includes data for all the time, for example, data of the year 1984. I use curl -v option to see the details. The output is included as follows.

* About to connect() to ichart.finance.yahoo.com port 80

* Trying 76.13.114.89... connected

* Connected to ichart.finance.yahoo.com (76.13.114.89) port 80

> GET /table.csv?s=AAPL HTTP/1.1

> User-Agent: curl/7.15.5 (i686-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5

> Host: ichart.finance.yahoo.com

> Accept: */*

From the output above, I find the parameters &a=3&b=12&c=2008&d=8&e=5&f=2009&g=d&ignore=.csv are not in the Get request.

I am new to perl and would like to get feedback from here. Thanks.


In reply to How to call curl to make a Get request with parameters from perl ? by perl0101

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.