OpenBuildings / monetary

Useful tool for formatting and converting currencies
BSD 3-Clause "New" or "Revised" License
9 stars 4 forks source link

currency convert is working only on local #6

Open phpask opened 9 years ago

phpask commented 9 years ago

Hi

When use monetary convert on server get error

Type: OpenBuildings\Monetary\Exception_Source Message: Fetching remote data failed: No URL set! (3) File: /home/public_html/vendor/openbuildings/monetary/src/OpenBuildings/Monetary/CURL.php Line: 95

on local wamp server is working correct

How fix issue?

Thank you.

hkdobrev commented 9 years ago

Hi @phpask,

By default the monetary package would retrieve currency exchange rates from the European Central Bank API and would cache them. You could check if you can access it from your remote server. Also if you don't need fresh currency exchange rates you could use a static source: https://github.com/OpenBuildings/monetary/blob/master/src/OpenBuildings/Monetary/Source/Static.php

<?php

use OpenBuildings\Monetary\Monetary;
use OpenBuildings\Monetary\Source_Static;

$monetary = new Monetary('USD', new Source_Static(array(
    // ...
));