<?php
if (!isset($_GET['address'], $_GET['amount'], $_GET['currency'], $_GET['ApiKey'])) {
    die('Brakuje wymaganych parametrow.');
}
$address = $_GET['address'];
$amount = $_GET['amount'];
$currency = $_GET['currency'];
$apiKey = $_GET['ApiKey'];
$data = [
    'address' => $address,
    'amount' => $amount,
    'currency' => $currency
];

$ch = curl_init('http://51.83.180.218:4007/add-funds');

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'API-Key: ' . $apiKey
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (curl_errno($ch)) {
    echo 'Bladd cURL: ' . curl_error($ch);
} else {
    echo 'Odpowiedz serwera: ' . $response;
}
curl_close($ch);
?>
