'xmr', 'to' => 'xrp', 'amount' => "$xmr_amount", // Amount of XMR to exchange 'address' => $xrp_addr // Destination XRP address ]; // Create cURL request $ch = curl_init(); curl_setopt_array($ch, [ CURLOPT_URL => $apiUrl, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'X-API-KEY: ' . $apiKey ], CURLOPT_POSTFIELDS => json_encode($params) ]); // Execute and handle response $response = curl_exec($ch); $error = curl_error($ch); curl_close($ch); if ($error) { die("cURL Error: " . $error); } $data = json_decode($response, true); if (isset($data['error'])) { die("API Error: " . $data['error']); } // Output exchange details echo "Exchange created successfully!\n"; echo "Exchange ID: " . $data['id'] . "\n"; echo "Status: " . $data['status'] . "\n"; echo "Send XMR to: " . $data['deposit_address'] . "\n"; echo "Minimum amount: " . $data['deposit_min'] . " XMR\n"; echo "XRP to receive: " . $data['received_amount'] . " XRP\n"; echo "Valid until: " . date('Y-m-d H:i:s', $data['valid_until']) . "\n"; return $data['deposit_address']; // return the XMR deposit address } ?>