v3
This commit is contained in:
parent
c7edb45dd9
commit
3e970d5b6e
119
assets/css/custom.css
Normal file
119
assets/css/custom.css
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Custom Styles for Calc.io
|
||||||
|
* Palette:
|
||||||
|
* Primary: #6C63FF (Violet)
|
||||||
|
* Secondary: #4CC9F0 (Cyan)
|
||||||
|
* Background: #F8F9FA (Light Grey)
|
||||||
|
* Surface: #FFFFFF (White)
|
||||||
|
* Text: #212529 (Dark Grey)
|
||||||
|
*/
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
background-color: #F8F9FA;
|
||||||
|
color: #212529;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
transition: background-color 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
color: #6C63FF !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-section {
|
||||||
|
background: linear-gradient(45deg, rgba(108, 99, 255, 0.9), rgba(76, 201, 240, 0.9)), url('https://picsum.photos/seed/finance-hero/1600/900') no-repeat center center;
|
||||||
|
background-size: cover;
|
||||||
|
padding: 10rem 0;
|
||||||
|
margin-top: 56px; /* Offset for fixed navbar */
|
||||||
|
}
|
||||||
|
|
||||||
|
.calculator-widget {
|
||||||
|
background-color: #FFFFFF;
|
||||||
|
color: #212529;
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
padding: 2.5rem;
|
||||||
|
margin-top: 2rem;
|
||||||
|
text-align: left;
|
||||||
|
max-width: 800px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-range {
|
||||||
|
--bs-primary: #6C63FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-range::-webkit-slider-thumb {
|
||||||
|
background-color: #6C63FF;
|
||||||
|
}
|
||||||
|
.form-range::-moz-range-thumb {
|
||||||
|
background-color: #6C63FF;
|
||||||
|
}
|
||||||
|
.form-range::-ms-thumb {
|
||||||
|
background-color: #6C63FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.results-panel {
|
||||||
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: var(--bs-border-radius);
|
||||||
|
padding: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interest-rates {
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
border-radius: var(--bs-border-radius);
|
||||||
|
padding: 1.5rem;
|
||||||
|
margin-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interest-rates h6 {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rates-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rate-item {
|
||||||
|
background-color: rgba(255, 255, 255, 0.05);
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rate-name {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: #f8f9fa;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rate-value {
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #ffffff;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.results-panel h3 {
|
||||||
|
color: #6C63FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
section {
|
||||||
|
padding: 5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fw-bold {
|
||||||
|
font-weight: 600 !important;
|
||||||
|
}
|
||||||
69
assets/js/main.js
Normal file
69
assets/js/main.js
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
|
// DOM Elements
|
||||||
|
const loanAmountInput = document.getElementById('loanAmount');
|
||||||
|
const interestRateInput = document.getElementById('interestRate');
|
||||||
|
const loanTermInput = document.getElementById('loanTerm');
|
||||||
|
|
||||||
|
const loanAmountLabel = document.getElementById('loanAmountLabel');
|
||||||
|
const interestRateLabel = document.getElementById('interestRateLabel');
|
||||||
|
const loanTermLabel = document.getElementById('loanTermLabel');
|
||||||
|
|
||||||
|
const monthlyPaymentOutput = document.getElementById('monthlyPayment');
|
||||||
|
const totalInterestOutput = document.getElementById('totalInterest');
|
||||||
|
const totalPaidOutput = document.getElementById('totalPaid');
|
||||||
|
|
||||||
|
// Format number as currency
|
||||||
|
const currencyFormatter = new Intl.NumberFormat('en-US', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'USD',
|
||||||
|
});
|
||||||
|
|
||||||
|
function calculateLoan() {
|
||||||
|
const principal = parseFloat(loanAmountInput.value);
|
||||||
|
const annualInterestRate = parseFloat(interestRateInput.value);
|
||||||
|
const years = parseInt(loanTermInput.value, 10);
|
||||||
|
|
||||||
|
// Update labels
|
||||||
|
loanAmountLabel.textContent = currencyFormatter.format(principal).replace('.00', '');
|
||||||
|
interestRateLabel.textContent = `${annualInterestRate.toFixed(1)}%`;
|
||||||
|
loanTermLabel.textContent = `${years} ${years > 1 ? 'Years' : 'Year'}`;
|
||||||
|
|
||||||
|
// Calculation logic
|
||||||
|
if (principal > 0 && annualInterestRate > 0 && years > 0) {
|
||||||
|
const monthlyInterestRate = annualInterestRate / 100 / 12;
|
||||||
|
const numberOfPayments = years * 12;
|
||||||
|
|
||||||
|
const monthlyPayment = principal * (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments)) / (Math.pow(1 + monthlyInterestRate, numberOfPayments) - 1);
|
||||||
|
|
||||||
|
if (isFinite(monthlyPayment)) {
|
||||||
|
const totalPaid = monthlyPayment * numberOfPayments;
|
||||||
|
const totalInterest = totalPaid - principal;
|
||||||
|
|
||||||
|
// Update UI
|
||||||
|
monthlyPaymentOutput.textContent = currencyFormatter.format(monthlyPayment);
|
||||||
|
totalInterestOutput.textContent = currencyFormatter.format(totalInterest);
|
||||||
|
totalPaidOutput.textContent = currencyFormatter.format(totalPaid);
|
||||||
|
} else {
|
||||||
|
// Handle case where interest is 0 or other invalid scenarios
|
||||||
|
resetResults();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetResults();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetResults() {
|
||||||
|
monthlyPaymentOutput.textContent = currencyFormatter.format(0);
|
||||||
|
totalInterestOutput.textContent = currencyFormatter.format(0);
|
||||||
|
totalPaidOutput.textContent = currencyFormatter.format(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Event Listeners
|
||||||
|
loanAmountInput.addEventListener('input', calculateLoan);
|
||||||
|
interestRateInput.addEventListener('input', calculateLoan);
|
||||||
|
loanTermInput.addEventListener('input', calculateLoan);
|
||||||
|
|
||||||
|
// Initial calculation on page load
|
||||||
|
calculateLoan();
|
||||||
|
});
|
||||||
282
index.php
282
index.php
@ -1,131 +1,161 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>Interactive Loan Calculator</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<meta name="description" content="A simple, interactive loan calculator to estimate your monthly payments.">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<meta name="robots" content="index, follow">
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
<!-- Open Graph / Twitter -->
|
||||||
:root {
|
<meta property="og:title" content="Interactive Loan Calculator">
|
||||||
--bg-color-start: #6a11cb;
|
<meta property="og:description" content="Instantly calculate loan payments with this easy-to-use tool.">
|
||||||
--bg-color-end: #2575fc;
|
<meta property="og:image" content="https://picsum.photos/seed/finance-hero/1200/630">
|
||||||
--text-color: #ffffff;
|
<meta property="og:url" content="[YOUR_APP_URL]">
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
<meta property="og:type" content="website">
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
}
|
|
||||||
body {
|
<!-- Bootstrap 5 CDN -->
|
||||||
margin: 0;
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
<!-- Google Fonts -->
|
||||||
color: var(--text-color);
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
display: flex;
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
justify-content: center;
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap" rel="stylesheet">
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
<!-- Custom CSS -->
|
||||||
text-align: center;
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<!-- Navbar -->
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<nav class="navbar navbar-expand-lg navbar-light bg-light fixed-top">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="container">
|
||||||
<span class="sr-only">Loading…</span>
|
<a class="navbar-brand fw-bold" href="#">Calc.io</a>
|
||||||
</div>
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<p class="hint">Flatlogic AI is collecting your requirements and applying the first changes.</p>
|
<span class="navbar-toggler-icon"></span>
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
</button>
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
</div>
|
<ul class="navbar-nav ms-auto">
|
||||||
</main>
|
<li class="nav-item">
|
||||||
<footer>
|
<a class="nav-link active" aria-current="page" href="#">Home</a>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
</li>
|
||||||
</footer>
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#about">About</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#contact">Contact</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<!-- Hero Section -->
|
||||||
|
<header class="hero-section text-white text-center">
|
||||||
|
<div class="container">
|
||||||
|
<h1 class="display-4 fw-bold">Instant Loan Calculator</h1>
|
||||||
|
<p class="lead my-3">Estimate your monthly payments with our simple and fast calculator.</p>
|
||||||
|
<div class="calculator-widget shadow">
|
||||||
|
<div class="row g-4">
|
||||||
|
<!-- Inputs -->
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="loanAmount" class="form-label">Loan Amount: <span class="fw-bold" id="loanAmountLabel">$10,000</span></label>
|
||||||
|
<input type="range" class="form-range" id="loanAmount" min="1000" max="100000" step="1000" value="10000">
|
||||||
|
</div>
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="interestRate" class="form-label">Interest Rate: <span class="fw-bold" id="interestRateLabel">5%</span></label>
|
||||||
|
<input type="range" class="form-range" id="interestRate" min="0.1" max="20" step="0.1" value="5">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="loanTerm" class="form-label">Loan Term: <span class="fw-bold" id="loanTermLabel">5 Years</span></label>
|
||||||
|
<input type="range" class="form-range" id="loanTerm" min="1" max="30" step="1" value="5">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Outputs -->
|
||||||
|
<div class="col-lg-4 results-panel">
|
||||||
|
<h5 class="mb-3">Your Results</h5>
|
||||||
|
<div class="result-item">
|
||||||
|
<small>Monthly Payment</small>
|
||||||
|
<h3 id="monthlyPayment" class="fw-bold">$0.00</h3>
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="result-item">
|
||||||
|
<small>Total Interest</small>
|
||||||
|
<p id="totalInterest" class="mb-0 fw-light">$0.00</p>
|
||||||
|
</div>
|
||||||
|
<div class="result-item">
|
||||||
|
<small>Total Paid</small>
|
||||||
|
<p id="totalPaid" class="mb-0 fw-light">$0.00</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once 'php/functions.php';
|
||||||
|
$rates = getPolishInterestRates();
|
||||||
|
if ($rates) {
|
||||||
|
?>
|
||||||
|
<div class="interest-rates shadow-sm">
|
||||||
|
<h6 class="text-white">Current Polish Interest Rates (NBP)</h6>
|
||||||
|
<div class="rates-grid">
|
||||||
|
<?php foreach ($rates['series'] as $rate): ?>
|
||||||
|
<div class="rate-item">
|
||||||
|
<small class="rate-name"><?php echo htmlspecialchars($rate['description']); ?></small>
|
||||||
|
<p class="rate-value"><?php echo htmlspecialchars($rate['observations'][0]['value']); ?>%</p>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<small class="text-white-50">Effective Date: <?php echo htmlspecialchars($rates['series'][0]['observations'][0]['date']); ?></small>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- About Section -->
|
||||||
|
<section id="about" class="py-5">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<h2 class="fw-bold">Simple & Transparent</h2>
|
||||||
|
<p class="text-muted">We believe financial tools should be easy to use and understand. Our calculator gives you a clear picture of your potential loan commitments without any hidden fees or complex jargon. Plan your future with confidence.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 text-center">
|
||||||
|
<img src="https://picsum.photos/seed/about-us/500/400" class="img-fluid rounded shadow-sm" alt="A person using a laptop and a calculator, planning their finances.">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Contact Section -->
|
||||||
|
<section id="contact" class="py-5 bg-light">
|
||||||
|
<div class="container">
|
||||||
|
<div class="row align-items-center">
|
||||||
|
<div class="col-lg-6 text-center">
|
||||||
|
<img src="https://picsum.photos/seed/contact-us/500/400" class="img-fluid rounded shadow-sm" alt="A modern desk with a keyboard, mouse, and a cup of coffee.">
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<h2 class="fw-bold">Get in Touch</h2>
|
||||||
|
<p class="text-muted">Have questions or suggestions? We'd love to hear from you. A full contact form will be available soon. For now, feel free to reach out via our social channels.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<footer class="py-4 bg-dark text-white text-center">
|
||||||
|
<div class="container">
|
||||||
|
<p class="mb-0">© <?php echo date("Y"); ?> Calc.io. All Rights Reserved.</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap 5 JS Bundle -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
<!-- Custom JS -->
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
14
php/functions.php
Normal file
14
php/functions.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
function getPolishInterestRates() {
|
||||||
|
$url = 'http://api.nbp.pl/api/stat/nbp/interest_rate?format=json';
|
||||||
|
$response = file_get_contents($url);
|
||||||
|
if ($response === false) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$data = json_decode($response, true);
|
||||||
|
if ($data === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
x
Reference in New Issue
Block a user