public static function getRate($from, $to) {
    // Check if currencies exists
    if (!Connect2PayCurrencyHelper::currencyIsAvailable($from) || !Connect2PayCurrencyHelper::currencyIsAvailable($to)) {
      return null;
    }

    // Build the request URL
    $url = Connect2PayCurrencyHelper::$APIIO_SERVICE_URL . date("Y-m-d") . "?base=" . $from . "&symbols=" . $to;

    // Do the request
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    if (Connect2PayCurrencyHelper::$proxy_host != null && Connect2PayCurrencyHelper::$proxy_port != null) {
      curl_setopt($curl, CURLOPT_PROXY, Connect2PayCurrencyHelper::$proxy_host);
      curl_setopt($curl, CURLOPT_PROXYPORT, Connect2PayCurrencyHelper::$proxy_port);

      if (Connect2PayCurrencyHelper::$proxy_username != null && Connect2PayCurrencyHelper::$proxy_password != null) {
        curl_setopt($curl, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
        curl_setopt($curl, CURLOPT_PROXYUSERPWD,
            Connect2PayCurrencyHelper::$proxy_username . ":" . Connect2PayCurrencyHelper::$proxy_password);
      }
    }

    $json = trim(curl_exec($curl));
    $httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    curl_close($curl);

    if ($httpCode == 200) {
      // Parse the CSV, we should only have a number, check this
      $obj = json_decode($json, true);

      if (is_array($obj) && array_key_exists("rates", $obj) && array_key_exists($to, $obj['rates']) &&
          preg_match('/^[0-9.]+$/', $obj['rates'][$to])) {
        return $obj['rates'][$to];
      }
    }

    return null;
  }