<?php
$apiKey = 'vXgdTiWzhes05saTrdnvCoKl9y46jZZKYt78LTNXHTUBRs5ZvnYPN9bzPiEShE99';
$apiSecret = 'F3Zqj9QoQeh3bk1BNTuwnHSsyVEHDmPnunh1qGtNUKtGfvexj27dhgLvYvRRfBc9';

// Binance API endpoint
$endpoint = 'https://api-gcp.binance.com/api/v3/account';

// Generate a timestamp
$timestamp = round(microtime(true) * 1000);

// Create a query string
$queryString = "timestamp={$timestamp}";

// Create a signature
$signature = hash_hmac('sha256', $queryString, $apiSecret);

// Add the signature to the query string
$queryString .= "&signature={$signature}";

// Create headers
$headers = [
    "X-MBX-APIKEY: {$apiKey}"
];

// Initialize curl
$ch = curl_init();

// Set curl options
curl_setopt($ch, CURLOPT_URL, "{$endpoint}?{$queryString}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

// Execute curl request
$response = curl_exec($ch);

// Check for curl errors
if (curl_errno($ch)) {
    echo 'Curl error: ' . curl_error($ch);
    exit;
}

// Close curl
curl_close($ch);

// Decode the JSON response
$data = json_decode($response, true);

// Filter and print the USDT balance
foreach ($data['balances'] as $asset) {
    if ($asset['asset'] == 'USDT') {
        echo "USDT Balance: " . $asset['free'];
    }
}
?>