Giter Site home page Giter Site logo

exchangeratesapi's People

Contributors

andrey-mostovoy avatar benmajor avatar dpash avatar glennjacobs avatar iganev avatar sashotoster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

exchangeratesapi's Issues

No longer that free

Apparently, "the awesome, free ExchangeRatesAPI" is no longer that free. As of today, our services relying upon this API started to fail, and I discovered that exchangeratesapi.io started to require API key, and only 250 requests/month are free. Everyone needs to run their server.

Undefined property: stdClass::$base

Just had an issue here, i think its related to the Endpoint Response?

How to produce the error

        $lookup = new ExchangeRatesAPI();
        $rates  = $lookup->addRate('USD')->setBaseCurrency('SGD')->fetch();
        $rate = $rates->getRates();
        echo $rate;

Screenshoot
image

Libraries Used
"guzzlehttp/guzzle": "^6.4"
"benmajor/exchange-rates-api": "^1.0"
"php": "^7.1.3"

PHP is not supported

I noticed in the list
private $_currencies = [ 'USD', 'GBP', 'EUR', 'JPY', 'BGN', 'CZK', 'DKK', 'HUF', 'PLN', 'RON', 'SEK', 'CHF', 'ISK', 'NOK', 'HRK', 'RUB', 'TRY', 'AUD', 'BRL', 'CAD', 'CNY', 'HKD', 'IDR', 'ILS', 'INR', 'KRW', 'MXN', 'MYR', 'NZD', 'BHP', 'SGD', 'THB', 'ZAR' ];

There are BHP currencies but no PHP
So is there a mistake here?

Cannot call functions from ExchangeRatesAPI.php

Hi,

I am trying to call some functions (E.g. trying to get the base currency below) from the ones available in ExchangeRatesAPI.php to my Wordpress site but they break my site when I do so. Whe I fetch the whole data body using Worpress function wp_remote_get() I can see the expected outcome but I need to show only one rate at a time and take 2 parameters for the 2 currencies so that's why I am trying to use the ExchangeRatesAPI.php functions. Am I doing something wrong or is there any other issue I should be aware of? Thanks in advance for any answer

//https://github.com/benmajor/ExchangeRatesAPI#3-getting-started
require_once 'C:\ExchangeRatesAPI-master\src\ExchangeRatesAPI.php';


$request = wp_remote_get( 'https://api.exchangeratesapi.io/latest?base=USD' );
if( is_wp_error( $request ) ) {
	return false; // Bail early
}
$body = wp_remote_retrieve_body( $request );
$data = json_decode( $body );
//echo "<pre>"; //this is for cleaning the data in visualitation
//print_r($data); //print output

use \BenMajor\ExchangeRatesAPI\ExchangeRatesAPI;
use \BenMajor\ExchangeRatesAPI\Response;
use \BenMajor\ExchangeRatesAPI\Exception;

$lookup = new ExchangeRatesAPI();
$base  = $lookup->getBaseCurrency();

function mytest(){
$base=getBaseCurrency();
return $base;}
add_shortcode( 'base', 'mytest' );

Fetching exchange rate for specific date does not work

Version: 4.2.0

After upgrading from v3 to v4, fetching exchange rate on a specific date does not work, using code below:

$lookup = new ExchangeRatesAPI($key, false);
$lookup->setBaseCurrency('USD');
$lookup->addRate('EUR');

$lookup->setFetchDate('2024-01-01');
$rates = $lookup->fetch();

Exception:

BenMajor\ExchangeRatesAPI\Exception

Undefined property: stdClass::$timestamp

It seems, using this, the $date is used as API endpoint, as per

$endpoint = is_null($this->fetchDate) ? self::ENDPOINT_MOST_RECENT_EXCHANGE_RATES : $this->fetchDate;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.