Solved

Getting download url for csv file from google docs

Posted on 2012-03-18
7
674 Views
Last Modified: 2012-03-21
I don't know much about google docs.

There's this spreadsheet:

https://docs.google.com/spreadsheet/ccc?key=0Av2v4lMxiJ1AdE9laEZJdzhmMzdmcW90VWNfUTYtM2c#gid=1

If you go to 'file', 'download as csv', I can get a nice download of exactly what I need.

Now the challenge :

I need to have my server grab that csv file from google docs once a day. I'll probably use php and do this:

file_get_contents('https://docs.google.com/spreadsheet/ccc?key=....');

But.... I can't figure out what the url is to download the csv file. It's not on the source code, not that I can find at least.

Can someone help figure out what the url is I need to access the csv file? I did have someone say I could use a proxy to analyze the download and find it that way, but I'm not sure how to do that,

Thanks,

Chris
0
Comment
Question by:St_Aug_Beach_Bum
  • 4
  • 3
7 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 37735740
From the 50,000 foot view, what is the objective here?  Are you looking for currency exchange rates?
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 37735979
yes, would like to find a free feed with a large number of currencies.
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 37735986
Something fairly straight forward, like a csv file, that I can use in my own script and dump into a mysql db once a day.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 108

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 37737103
Have a look at this.  You may be able to adapt that, perhaps using the getRates() method.  You may want to get permission to use 99currencies.
<?php // RAY_currency_converter.php
error_reporting(E_ALL);

// PHP 5.1+  SEE http://php.net/manual/en/function.date-default-timezone-set.php
date_default_timezone_set('America/Chicago');

class CurrencyConverter
{
    protected $error, $norml, $terse, $verbose, $array, $rates;
    protected static $currs;

    public function __construct()
    {
        // READ THE EXCHANGE RATES
        $url = 'http://www.99currencies.com/currency/curr.php';
        $str = file_get_contents($url);
        $str = str_replace(':CUR', NULL, $str);
        $this->rates = json_decode($str, TRUE);

        // DATA ADAPTED FROM XE.COM - SEE ALSO: http://en.wikipedia.org/wiki/ISO_4217
        $this->currs["AED"] = array("N" => "United Arab Emirates",                                 "C" => "Dirhams");
        $this->currs["AFN"] = array("N" => "Afghanistan",                                          "C" => "Afghanis");
        $this->currs["ALL"] = array("N" => "Albania",                                              "C" => "Leke");
        $this->currs["AMD"] = array("N" => "Armenia",                                              "C" => "Drams");
        $this->currs["ANG"] = array("N" => "Netherlands Antilles",                                 "C" => "Guilders (also called Florins)");
        $this->currs["AOA"] = array("N" => "Angola",                                               "C" => "Kwanza");
        $this->currs["ARS"] = array("N" => "Argentina",                                            "C" => "Pesos");
        $this->currs["AUD"] = array("N" => "Australia",                                            "C" => "Dollars");
        $this->currs["AWG"] = array("N" => "Aruba",                                                "C" => "Guilders (also called Florins)");
        $this->currs["AZN"] = array("N" => "Azerbaijan",                                           "C" => "New Manats");
        $this->currs["BAM"] = array("N" => "Bosnia and Herzegovina",                               "C" => "Convertible Marka");
        $this->currs["BBD"] = array("N" => "Barbados",                                             "C" => "Dollars");
        $this->currs["BDT"] = array("N" => "Bangladesh",                                           "C" => "Taka");
        $this->currs["BGN"] = array("N" => "Bulgaria",                                             "C" => "Leva");
        $this->currs["BHD"] = array("N" => "Bahrain",                                              "C" => "Dinars");
        $this->currs["BIF"] = array("N" => "Burundi",                                              "C" => "Francs");
        $this->currs["BMD"] = array("N" => "Bermuda",                                              "C" => "Dollars");
        $this->currs["BND"] = array("N" => "Brunei Darussalam",                                    "C" => "Dollars");
        $this->currs["BOB"] = array("N" => "Bolivia",                                              "C" => "Bolivianos");
        $this->currs["BRL"] = array("N" => "Brazil",                                               "C" => "Brazil Real");
        $this->currs["BSD"] = array("N" => "Bahamas",                                              "C" => "Dollars");
        $this->currs["BTN"] = array("N" => "Bhutan",                                               "C" => "Ngultrum");
        $this->currs["BWP"] = array("N" => "Botswana",                                             "C" => "Pulas");
        $this->currs["BYR"] = array("N" => "Belarus",                                              "C" => "Rubles");
        $this->currs["BZD"] = array("N" => "Belize",                                               "C" => "Dollars");
        $this->currs["CAD"] = array("N" => "Canada",                                               "C" => "Dollars");
        $this->currs["CDF"] = array("N" => "Congo/Kinshasa",                                       "C" => "Congolese Francs");
        $this->currs["CHF"] = array("N" => "Switzerland",                                          "C" => "Francs");
        $this->currs["CLP"] = array("N" => "Chile",                                                "C" => "Pesos");
        $this->currs["CNY"] = array("N" => "China",                                                "C" => "Yuan Renminbi");
        $this->currs["COP"] = array("N" => "Colombia",                                             "C" => "Pesos");
        $this->currs["CRC"] = array("N" => "Costa Rica",                                           "C" => "Colones");
        $this->currs["CUP"] = array("N" => "Cuba",                                                 "C" => "Pesos");
        $this->currs["CVE"] = array("N" => "Cape Verde",                                           "C" => "Escudos");
        $this->currs["CYP"] = array("N" => "Cyprus",                                               "C" => "Pounds (expires 2008-Jan-31)");
        $this->currs["CZK"] = array("N" => "Czech Republic",                                       "C" => "Koruny");
        $this->currs["DJF"] = array("N" => "Djibouti",                                             "C" => "Francs");
        $this->currs["DKK"] = array("N" => "Denmark",                                              "C" => "Kroner");
        $this->currs["DOP"] = array("N" => "Dominican Republic",                                   "C" => "Pesos");
        $this->currs["DZD"] = array("N" => "Algeria",                                              "C" => "Algeria Dinars");
        $this->currs["EEK"] = array("N" => "Estonia",                                              "C" => "Krooni");
        $this->currs["EGP"] = array("N" => "Egypt",                                                "C" => "Pounds");
        $this->currs["ERN"] = array("N" => "Eritrea",                                              "C" => "Nakfa");
        $this->currs["ETB"] = array("N" => "Ethiopia",                                             "C" => "Birr");
        $this->currs["EUR"] = array("N" => "Euro Member Countries",                                "C" => "Euro");
        $this->currs["FJD"] = array("N" => "Fiji",                                                 "C" => "Dollars");
        $this->currs["FKP"] = array("N" => "Falkland Islands (Malvinas)",                          "C" => "Pounds");
        $this->currs["GBP"] = array("N" => "United Kingdom",                                       "C" => "Pounds");
        $this->currs["GEL"] = array("N" => "Georgia",                                              "C" => "Lari");
        $this->currs["GGP"] = array("N" => "Guernsey",                                             "C" => "Pounds");
        $this->currs["GHS"] = array("N" => "Ghana",                                                "C" => "Cedis");
        $this->currs["GIP"] = array("N" => "Gibraltar",                                            "C" => "Pounds");
        $this->currs["GMD"] = array("N" => "Gambia",                                               "C" => "Dalasi");
        $this->currs["GNF"] = array("N" => "Guinea",                                               "C" => "Francs");
        $this->currs["GTQ"] = array("N" => "Guatemala",                                            "C" => "Quetzales");
        $this->currs["GYD"] = array("N" => "Guyana",                                               "C" => "Dollars");
        $this->currs["HKD"] = array("N" => "Hong Kong",                                            "C" => "Dollars");
        $this->currs["HNL"] = array("N" => "Honduras",                                             "C" => "Lempiras");
        $this->currs["HRK"] = array("N" => "Croatia",                                              "C" => "Kuna");
        $this->currs["HTG"] = array("N" => "Haiti",                                                "C" => "Gourdes");
        $this->currs["HUF"] = array("N" => "Hungary",                                              "C" => "Forint");
        $this->currs["IDR"] = array("N" => "Indonesia",                                            "C" => "Rupiahs");
        $this->currs["ILS"] = array("N" => "Israel",                                               "C" => "New Shekels");
        $this->currs["IMP"] = array("N" => "Isle of Man",                                          "C" => "Pounds");
        $this->currs["INR"] = array("N" => "India",                                                "C" => "Rupees");
        $this->currs["IQD"] = array("N" => "Iraq",                                                 "C" => "Dinars");
        $this->currs["IRR"] = array("N" => "Iran",                                                 "C" => "Rials");
        $this->currs["ISK"] = array("N" => "Iceland",                                              "C" => "Kronur");
        $this->currs["JEP"] = array("N" => "Jersey",                                               "C" => "Pounds");
        $this->currs["JMD"] = array("N" => "Jamaica",                                              "C" => "Dollars");
        $this->currs["JOD"] = array("N" => "Jordan",                                               "C" => "Dinars");
        $this->currs["JPY"] = array("N" => "Japan",                                                "C" => "Yen");
        $this->currs["KES"] = array("N" => "Kenya",                                                "C" => "Shillings");
        $this->currs["KGS"] = array("N" => "Kyrgyzstan",                                           "C" => "Soms");
        $this->currs["KHR"] = array("N" => "Cambodia",                                             "C" => "Riels");
        $this->currs["KMF"] = array("N" => "Comoros",                                              "C" => "Francs");
        $this->currs["KPW"] = array("N" => "Korea (North)",                                        "C" => "Won");
        $this->currs["KRW"] = array("N" => "Korea (South)",                                        "C" => "Won");
        $this->currs["KWD"] = array("N" => "Kuwait",                                               "C" => "Dinars");
        $this->currs["KYD"] = array("N" => "Cayman Islands",                                       "C" => "Dollars");
        $this->currs["KZT"] = array("N" => "Kazakhstan",                                           "C" => "Tenge");
        $this->currs["LAK"] = array("N" => "Laos",                                                 "C" => "Kips");
        $this->currs["LBP"] = array("N" => "Lebanon",                                              "C" => "Pounds");
        $this->currs["LKR"] = array("N" => "Sri Lanka",                                            "C" => "Rupees");
        $this->currs["LRD"] = array("N" => "Liberia",                                              "C" => "Dollars");
        $this->currs["LSL"] = array("N" => "Lesotho",                                              "C" => "Maloti");
        $this->currs["LTL"] = array("N" => "Lithuania",                                            "C" => "Litai");
        $this->currs["LVL"] = array("N" => "Latvia",                                               "C" => "Lati");
        $this->currs["LYD"] = array("N" => "Libya",                                                "C" => "Dinars");
        $this->currs["MAD"] = array("N" => "Morocco",                                              "C" => "Dirhams");
        $this->currs["MDL"] = array("N" => "Moldova",                                              "C" => "Lei");
        $this->currs["MGA"] = array("N" => "Madagascar",                                           "C" => "Ariary");
        $this->currs["MKD"] = array("N" => "Macedonia",                                            "C" => "Denars");
        $this->currs["MMK"] = array("N" => "Myanmar (Burma)",                                      "C" => "Kyats");
        $this->currs["MNT"] = array("N" => "Mongolia",                                             "C" => "Tugriks");
        $this->currs["MOP"] = array("N" => "Macau",                                                "C" => "Patacas");
        $this->currs["MRO"] = array("N" => "Mauritania",                                           "C" => "Ouguiyas");
        $this->currs["MTL"] = array("N" => "Malta",                                                "C" => "Liri (expires 2008-Jan-31)");
        $this->currs["MUR"] = array("N" => "Mauritius",                                            "C" => "Rupees");
        $this->currs["MVR"] = array("N" => "Maldives (Maldive Islands)",                           "C" => "Rufiyaa");
        $this->currs["MWK"] = array("N" => "Malawi",                                               "C" => "Kwachas");
        $this->currs["MXN"] = array("N" => "Mexico",                                               "C" => "Pesos");
        $this->currs["MYR"] = array("N" => "Malaysia",                                             "C" => "Ringgits");
        $this->currs["MZN"] = array("N" => "Mozambique",                                           "C" => "Meticais");
        $this->currs["NAD"] = array("N" => "Namibia",                                              "C" => "Dollars");
        $this->currs["NGN"] = array("N" => "Nigeria",                                              "C" => "Nairas");
        $this->currs["NIO"] = array("N" => "Nicaragua",                                            "C" => "Cordobas");
        $this->currs["NOK"] = array("N" => "Norway",                                               "C" => "Krone");
        $this->currs["NPR"] = array("N" => "Nepal",                                                "C" => "Nepal Rupees");
        $this->currs["NZD"] = array("N" => "New Zealand",                                          "C" => "Dollars");
        $this->currs["OMR"] = array("N" => "Oman",                                                 "C" => "Rials");
        $this->currs["PAB"] = array("N" => "Panama",                                               "C" => "Balboa");
        $this->currs["PEN"] = array("N" => "Peru",                                                 "C" => "Nuevos Soles");
        $this->currs["PGK"] = array("N" => "Papua New Guinea",                                     "C" => "Kina");
        $this->currs["PHP"] = array("N" => "Philippines",                                          "C" => "Pesos");
        $this->currs["PKR"] = array("N" => "Pakistan",                                             "C" => "Rupees");
        $this->currs["PLN"] = array("N" => "Poland",                                               "C" => "Zlotych");
        $this->currs["PYG"] = array("N" => "Paraguay",                                             "C" => "Guarani");
        $this->currs["QAR"] = array("N" => "Qatar",                                                "C" => "Rials");
        $this->currs["RON"] = array("N" => "Romania",                                              "C" => "New Lei");
        $this->currs["RSD"] = array("N" => "Serbia",                                               "C" => "Dinars");
        $this->currs["RUB"] = array("N" => "Russia",                                               "C" => "Rubles");
        $this->currs["RWF"] = array("N" => "Rwanda",                                               "C" => "Rwanda Francs");
        $this->currs["SAR"] = array("N" => "Saudi Arabia",                                         "C" => "Riyals");
        $this->currs["SBD"] = array("N" => "Solomon Islands",                                      "C" => "Dollars");
        $this->currs["SCR"] = array("N" => "Seychelles",                                           "C" => "Rupees");
        $this->currs["SDG"] = array("N" => "Sudan",                                                "C" => "Pounds");
        $this->currs["SEK"] = array("N" => "Sweden",                                               "C" => "Kronor");
        $this->currs["SGD"] = array("N" => "Singapore",                                            "C" => "Dollars");
        $this->currs["SHP"] = array("N" => "Saint Helena",                                         "C" => "Pounds");
        $this->currs["SLL"] = array("N" => "Sierra Leone",                                         "C" => "Leones");
        $this->currs["SOS"] = array("N" => "Somalia",                                              "C" => "Shillings");
        $this->currs["SPL"] = array("N" => "Seborga",                                              "C" => "Luigini");
        $this->currs["SRD"] = array("N" => "Suriname",                                             "C" => "Dollars");
        $this->currs["STD"] = array("N" => "S&atilde;o Tome and Principe",                         "C" => "Dobras");
        $this->currs["SVC"] = array("N" => "El Salvador",                                          "C" => "Colones");
        $this->currs["SYP"] = array("N" => "Syria",                                                "C" => "Pounds");
        $this->currs["SZL"] = array("N" => "Swaziland",                                            "C" => "Emalangeni");
        $this->currs["THB"] = array("N" => "Thailand",                                             "C" => "Baht");
        $this->currs["TJS"] = array("N" => "Tajikistan",                                           "C" => "Somoni");
        $this->currs["TMM"] = array("N" => "Turkmenistan",                                         "C" => "Manats");
        $this->currs["TND"] = array("N" => "Tunisia",                                              "C" => "Dinars");
        $this->currs["TOP"] = array("N" => "Tonga",                                                "C" => "Pa&apos;anga");
        $this->currs["TRY"] = array("N" => "Turkey",                                               "C" => "New Lira");
        $this->currs["TTD"] = array("N" => "Trinidad and Tobago",                                  "C" => "Dollars");
        $this->currs["TVD"] = array("N" => "Tuvalu",                                               "C" => "Tuvalu Dollars");
        $this->currs["TWD"] = array("N" => "Taiwan",                                               "C" => "New Dollars");
        $this->currs["TZS"] = array("N" => "Tanzania",                                             "C" => "Shillings");
        $this->currs["UAH"] = array("N" => "Ukraine",                                              "C" => "Hryvnia");
        $this->currs["UGX"] = array("N" => "Uganda",                                               "C" => "Shillings");
        $this->currs["USD"] = array("N" => "United States of America",                             "C" => "Dollars");
        $this->currs["UYU"] = array("N" => "Uruguay",                                              "C" => "Pesos");
        $this->currs["UZS"] = array("N" => "Uzbekistan",                                           "C" => "Sums");
        $this->currs["VEB"] = array("N" => "Venezuela",                                            "C" => "Bolivares (expires 2008-Jun-30)");
        $this->currs["VEF"] = array("N" => "Venezuela",                                            "C" => "Bolivares Fuertes");
        $this->currs["VND"] = array("N" => "Viet Nam",                                             "C" => "Dong");
        $this->currs["VUV"] = array("N" => "Vanuatu",                                              "C" => "Vatu");
        $this->currs["WST"] = array("N" => "Samoa",                                                "C" => "Tala");
        $this->currs["XAF"] = array("N" => "Communaut&eacute; Financi&egrave;re Africaine BEAC",   "C" => "Francs");
        $this->currs["XAG"] = array("N" => "Silver",                                               "C" => "Ounces");
        $this->currs["XAU"] = array("N" => "Gold",                                                 "C" => "Ounces");
        $this->currs["XCD"] = array("N" => "East Caribbean",                                       "C" => "Dollars");
        $this->currs["XDR"] = array("N" => "IMF Special Drawing Rights",                           "C" => "XDR");
        $this->currs["XOF"] = array("N" => "Communaut&eacute; Financi&egrave;re Africaine BCEAO",  "C" => "Francs");
        $this->currs["XPD"] = array("N" => "Palladium",                                            "C" => "Ounces");
        $this->currs["XPF"] = array("N" => "Comptoirs Fran&ccedil;ais du Pacifique Francs",        "C" => "CFP Francs");
        $this->currs["XPT"] = array("N" => "Platinum",                                             "C" => "Ounces");
        $this->currs["YER"] = array("N" => "Yemen",                                                "C" => "Rials");
        $this->currs["ZAR"] = array("N" => "South Africa",                                         "C" => "Rand");
        $this->currs["ZMK"] = array("N" => "Zambia",                                               "C" => "Kwacha");
        $this->currs["ZWD"] = array("N" => "Zimbabwe",                                             "C" => "Zimbabwe Dollars");

        // ELIMINATE THE MISMATCHED ITEMS
        $this->norml = $this->normalArrays();
        ksort($this->rates);
        ksort($this->currs);
    }

    public function getRates()
    {
        return $this->rates;
    }

    public function getCurrs()
    {
        return $this->currs;
    }

    public function getNormalization()
    {
        return $this->norml;
    }

    public function getError()
    {
        return $this->error;
    }

    public function asTerse()
    {
        return $this->terse;
    }

    public function asVerbose()
    {
        return $this->verbose;
    }

    public function asArray()
    {
        return $this->array;
    }

    public function normalArrays()
    {
        $response = NULL;
        foreach ($this->currs as $code => $x)
        {
            if (!isset($this->rates[$code]))
            {
                $response .= PHP_EOL . "$code IS IN CURRENCIES BUT NOT IN RATES";
                unset($this->currs[$code]);
            }
        }
        if ($response) $response .= PHP_EOL;
        foreach ($this->rates as $code => $x)
        {
            if (!isset($this->currs[$code]))
            {
                $response .= PHP_EOL . "$code IS IN RATES BUT NOT IN CURRENCIES";
                unset($this->rates[$code]);
            }
        }
        return $response;
    }

    public function isCurrency($code)
    {
        if (isset($this->rates[$code]))
        {
            return $this->rates[$code];
        }
        return FALSE;
    }

    public function convert($amount, $source_currency, $result_currency, $decimals=6)
    {
        // NORMALIZE DATA
        $this->array   = array();
        $this->error   = NULL;
        $this->terse   = NULL;
        $this->verbose = NULL;

        $source_currency = trim(strtoupper($source_currency));
        if (!isset($this->currs[$source_currency]))
        {
            $this->error .= "Currency $source_currency not found" . PHP_EOL;
        }

        $result_currency = trim(strtoupper($result_currency));
        if (!isset($this->currs[$result_currency]))
        {
            $this->error .= "Currency $result_currency not found" . PHP_EOL;
        }

        if ($this->error) return FALSE;

        // COMPUTE THE CONVERSION
        $rezult = 1.0 / $this->rates[$source_currency] * $this->rates[$result_currency] * $amount;

        //PREPARE THE RESPONSES
        $this->array
        = array
        ( "$source_currency" => number_format($amount, $decimals, '.', '')
        , "$result_currency" => number_format($rezult, $decimals, '.', '')
        )
        ;

        $this->terse
        = $this->array[$source_currency]
        . $source_currency
        . '='
        . $this->array[$result_currency]
        . "$result_currency"
        ;

        $this->verbose
        = $this->array[$source_currency]
        . ' '
        . $source_currency
        . ' ('
        . $this->currs[$source_currency]['N']
        . ' '
        . $this->currs[$source_currency]['C']
        . ')'
        . ' = '
        . $this->array[$result_currency]
        . ' '
        . $result_currency
        .' ('
        . $this->currs[$result_currency]['N']
        . ' '
        . $this->currs[$result_currency]['C']
        . ')'
        ;
        return (string)$rezult;
    }
}



// DEMONSTRATION SCRIPT
echo '<pre>';
$cc = new CurrencyConverter;

// SEE WHAT IS MISSING FROM THE CONVERTER
echo $cc->getNormalization();

// TRY THE SPOT PRICE OF AN OUNCE OF GOLD
$gold = $cc->convert(1.0, 'XAU', 'USD', 2);

// IF ANY ERROR OCCURRED
if ($cc->getError())
{
    echo PHP_EOL . $cc->getError();
}
else
{
    echo PHP_EOL . 'THE PRICE OF GOLD IS $' . number_format($gold,2);
}



// CONVERT 3 BRITISH POUNDS TO US DOLLARS
echo PHP_EOL . $cc->convert(3.0, 'gbp', 'usd', 2);

// IF ANY ERROR OCCURRED
if ($cc->getError()) echo PHP_EOL . $cc->getError();

// SHOW THE THREE RETURN METHODS
echo PHP_EOL . $cc->asTerse();
echo PHP_EOL . $cc->asVerbose();
echo PHP_EOL;  var_dump($cc->asArray());



// SHOW ERROR HANDLING - CONVERT 2 FOOS TO BARS
echo PHP_EOL . $cc->convert(2, 'Foo', 'Bar');

// IF ANY ERROR OCCURRED
if ($cc->getError()) echo PHP_EOL . $cc->getError();

// SHOW THE THREE RETURN METHODS
echo PHP_EOL . $cc->asTerse();
echo PHP_EOL . $cc->asVerbose();
echo PHP_EOL;  var_dump($cc->asArray());



// IF A FORM WAS SUBMITTED
if (!empty($_GET))
{
    $getResult = $cc->convert($_GET['a'], $_GET['f'], $_GET['t']);

    // IF ANY ERROR OCCURRED
    if ($cc->getError()) echo PHP_EOL . $cc->getError();

    // SHOW THE THREE RETURN METHODS
    echo PHP_EOL . $cc->asTerse();
    echo PHP_EOL . $cc->asVerbose();
    echo PHP_EOL;  var_dump($cc->asArray());
}


// CREATE A FORM FOR THE CLIENT
echo '<form>';

echo 'AMOUNT TO CONVERT: ';
echo '<input name="a" />';

echo '<br/>CHOOSE "FROM" CURRENCY';
echo '<br/><select name="f">' . PHP_EOL;
echo '<option value="NUL" selected="selected">CHOOSE CURRENCY</option>' . PHP_EOL;
foreach ($cc->getCurrs() as $code => $arr)
{
    echo '<option value="';
    echo $code;
    echo '">';
    echo $arr['N'];
    echo ' ';
    echo $arr['C'];
    echo '</option>' . PHP_EOL;
}
echo '</select>' . PHP_EOL;

echo '<br/>CHOOSE "TO" CURRENCY';
echo '<br/><select name="t">' . PHP_EOL;
echo '<option value="NUL" selected="selected">CHOOSE CURRENCY</option>' . PHP_EOL;
foreach ($cc->getCurrs() as $code => $arr)
{
    echo '<option value="';
    echo $code;
    echo '">';
    echo $arr['N'];
    echo ' ';
    echo $arr['C'];
    echo '</option>' . PHP_EOL;
}
echo '</select>' . PHP_EOL;

echo '<input type="submit" />';
echo '</form>';

// SHOW THE CURRENCIES WE HAVE IN THE OBJECT
print_r($cc->getCurrs());

// SHOW THE RATES WE HAVE IN THE OBJECT
print_r($cc->getRates());

Open in new window

0
 

Author Closing Comment

by:St_Aug_Beach_Bum
ID: 37750732
Got it Ray, thank you!

Chris
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 37750822
Chris: Thanks for the points.  Hope you're enjoying the Grapefruit League baseball this spring, this year! ~Ray
0
 

Author Comment

by:St_Aug_Beach_Bum
ID: 37751003
Ha - well, unfortunately, all their games are in south Florida, bit too far away from us to make it a fun day outing - and we aren't avid enough fans to make it a multi-day thing :)
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now