Change API currency switching provider in Joomla Component (php)

Suoritettu Julkaistu 6 vuotta sitten Maksettu toimituksen yhteydessä
Suoritettu Maksettu toimituksen yhteydessä

Component has the option to work with two currency converter provider, Yahoo Finance and Fixer.io.

Yahoo is deprecated and [url removed, login to view] does not have the currency I need. Then I need to add a third currency converter provider:

[url removed, login to view]

*/

private function callProviderYahoo()

{

//[url removed, login to view]

$apis_url = '[url removed, login to view]'. $this->from_currency . $this->to_currency .'=X';

$fp = @fopen($apis_url, 'r');

if ($fp) {

$data = '';

while (!feof($fp)) {

$data .= fread($fp, 4096);

}

if (!empty($data)) {

$data = str_replace("\"", "", $data);

$rate_info = explode(',', $data);

if (strlen($rate_info[1]) > 0 && floatval($rate_info[1]) > 0.00) {

return (float)$rate_info[1];

}

}

}

return false;

}

/**

* Call to the Fixer Foreign exchange rates and currency conversion API.

* Retrieve the conversion rate between base currency and symbol currency.

*

* @return mixed false in case of errors, float in case of success

*/

private function callProviderFixer()

{

//[url removed, login to view]

$apis_url = '[url removed, login to view]'.($this->from_currency != 'EUR' ? 'base='.$this->from_currency.'&' : '').'symbols='.$this->to_currency;

$fp = @fopen($apis_url, 'r');

if ($fp) {

$data = '';

while (!feof($fp)) {

$data .= fread($fp, 4096);

}

$resp = json_decode($data);

if (is_object($resp) && property_exists($resp, 'rates') && is_object($resp->rates)) {

$prop = $this->to_currency;

if (property_exists($resp->rates, $prop) && floatval($resp->rates->$prop) > 0.00) {

return (float)$resp->rates->$prop;

}

}

}

return false;

}

JSON PHP

Projektin tunnus: #15726937

Tietoa projektista

3 ehdotusta Etäprojekti Aktiivinen 6 vuotta sitten

Myönnetty käyttäjälle:

versacode

We are a group of electrical engineers and web developers. We can help you implement [login to view URL] API into your system with the required currencies. Relevant Skills and Experience We have 9+ years of Lisää

$30 USD 1 päivässä
(79 Arvostelua)
6.0

3 freelanceria on tarjonnut keskimäärin $33 tähän työhön

techweblabs

Hello there, we have a team that can do the task for you we specially work on PHP. Will be waiting for your reply to proceed. Thank you Have a great day! Sharath@techweblabs team

$33 USD 2 päivässä
(1 arvostelu)
0.4