If you are a web developer for costarican business is highly possible that you have been already requested to include the exchange rate in the page for conversion from 1 USD to Costa Rica colons.
With this simple code you can include the official reference Central Bank of Costa Rica exchange rate for USD directly from their web service and updated daily.
You have 3 options to choose at your convenience:
PHP
Please keep in mind that the module will use your your default website style so you can customize it as you preffer.
You can copy/paste the following code or if preferred download the zip file here (703 B).
<?php $today = date("d/m/Y"); $codigocompra = "317"; $codigoventa = "318"; function getIndicador($indicadordate,$indicadorcode){ $LongURL = "http://indicadoreseconomicos.bccr.fi.cr/indicadoreseconomicos/WebServices/wsIndicadoresEconomicos.asmx/ObtenerIndicadoresEconomicosXML?tcIndicador=" . $indicadorcode . "&tcFechaInicio=" . $indicadordate . "&tcFechaFinal=" . $indicadordate . "&tcNombre=Tester&tnSubNiveles=N"; $XRurl = file_get_contents($LongURL); $XRurl = str_replace("<","<",$XRurl); $XRurl = str_replace(">",">",$XRurl); $indicadorXML = new SimpleXMLElement($XRurl); $indicadorvalue = $indicadorXML->Datos_de_INGC011_CAT_INDICADORECONOMIC[0]->INGC011_CAT_INDICADORECONOMIC[0]->NUM_VALOR[0]; $indicadorvalue = number_format($indicadorvalue, 2); return $indicadorvalue; } echo "<ul><li>Compra: ₡ " . getIndicador($today,$codigocompra) . "</li><li>Venta: ₡ " . getIndicador($today,$codigoventa) . "</li></ul>" ; ?>
See how it works HERE.
WordPress widget
Download the WordPress Plugin (231 KB)
Installation
Extract all files from the ZIP file, and upload the xrcr-widget/
it to /wp-content/plugins/
.
Activate the plugin
Go to the admin area of your WordPress install and click on the “Plugins” menu. Click on “Activate” for the “Costa Rica Currency Exchange Rate” plugin.
Widget usage
- In the WordPress admin area go to “Appearance”, “Widgets”.
- Drag and drop the widget “Costa Rica Currency Exchange Rate” to the sidebar on the right to activate it.
Joomla module version
Download the Joomla Module (1.8 KB) | Demo
This is the instalable version of the module that will show the Costa Rica Currency Exchange Rate. Once again the module uses the default theme style for your convenience.
Installation
- From the Administrator area go to “Extensions”, “Extensions Manager”.
- Click on the “Choose File” button, select the
mod_xrcr.zip
and then click on the “Upload & Install” button.
Module activation
- From the Administrator area go to “Extensions”, “Module Manager”.
- Look for the module called “Costa Rica Currency Exchange Rate” (psst… tip, use the filter) and click on it.
- Select the position where you want to display the module.
- Change the Status to Published. Then click the “Save” button.