Code Monkey home page Code Monkey logo

Comments (3)

cryptoapi avatar cryptoapi commented on July 29, 2024 1

It is open source bitcoin library. You can modify it.

from payment-gateway.

cryptoapi avatar cryptoapi commented on July 29, 2024

thank you

from payment-gateway.

UgooAgbams avatar UgooAgbams commented on July 29, 2024

@gabisajr I want to disable the use of external currency converter and set my own exchange rate. Someone sugested this to me today

function convert_currency_live($from_Currency, $to_Currency, $amount)
{
    $amount = urlencode($amount);
    $from_Currency = trim(strtoupper(urlencode($from_Currency)));
    $to_Currency = trim(strtoupper(urlencode($to_Currency)));

    if($from_Currency == "NGN" && $to_Currency == "USD"){
        return round(($amount * 376), 2);
    }else{

        if ($from_Currency == "TRL")  $from_Currency = "TRY"; // fix for Turkish Lyra
        if ($from_Currency == "ZWD")  $from_Currency = "ZWL"; // fix for Zimbabwe Dollar
        if ($from_Currency == "RIAL") $from_Currency = "IRR"; // fix for Iranian Rial

        $url = "https://finance.google.com/finance/converter?a=".$amount."&from=".$from_Currency."&to=".$to_Currency;

        $ch = curl_init();
        curl_setopt ($ch, CURLOPT_URL, $url);
        curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko");
        curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt ($ch, CURLOPT_TIMEOUT, 20);
        $res = curl_exec($ch);
        curl_close($ch);

        if ($res)
        {
            $data = explode('bld>', $res);
            $data = explode($to_Currency, $data[1]);
            return round($data[0], ($to_Currency=="BTC"?5:2));
        }else{
            return -1; 
        }
    }`
```
What do you think?

from payment-gateway.

Related Issues (20)

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.