Can you please tell how to put the information of the Armenian Central Bank on the website - exchange rates?

    2 answers 2

    1. Form a request of the form:
      http://api.cba.am/ExchangeRatesToCSV.ashx?DateFrom=2012-01-01&DateTo=2012-03-30&ISOCodes=USD,GBP,RUB,EUR
      substituting the necessary dates and currency codes, while the dates are specified in the format yyyy-mm-dd
    2. Disassemble the resulting CSV. Data fields are separated by commas. The first line is the heading, each subsequent one represents the course values ​​for a specific date, with the first field (date) being in the format dd / mm / yyyy, followed by the last field also followed by a comma. For example, the first three lines for the above query look like this:
      Ամսաթիվ,USD,GBP,RUB,EUR
      09/01/2012,386.1500,596.2200,12.1200,493.2700,
      10/01/2012,387.0700,599.3800,12.2000,495.1800,

      Next, I hope, you can do it yourself, because I do not know your project and your specific goals.

       $data=file_get_contents('http://www.cba.am/am/SitePages/Default.aspx'); preg_match_all('/<b>USD<\/b>.*?<\/li>\r/i', $data, $arr); echo htmlspecialchars($arr[0][0]); 

      Result

       <b>USD</b></em><em class="w_50">1</em><em class="w_50">390.64</em><em class="w_40 ico_green">0.34</em><div class="ac clear"></div></li><li class="light_gray_2" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ddw1="http://www.cba.am/" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"><em class="w_50"><b>GBP</b></em><em class="w_50">1</em><em class="w_50">625.45</em><em class="w_40 ico_green">4.99</em><div class="ac clear"></div></li><li class="light_gray_2" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ddw1="http://www.cba.am/" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"><em class="w_50"><b>EUR</b></em><em class="w_50">1</em><em class="w_50">521.39</em><em class="w_40 ico_green">3.07</em><div class="ac clear"></div></li><li class="light_gray_2" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ddw1="http://www.cba.am/" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"><em class="w_50"><b>RUB</b></em><em class="w_50">1</em><em class="w_50">13.31</em><em class="w_40 ico_green">0.03</em><div class="ac clear"></div></li>