Live 📶

STAR GOLD TRADERS

LIVE GOLD RATE

Pakistan • PKR • Per Tola
GOLD 24K
Loading…
PKR / TOLA
GOLD 22K
Loading…
PKR / TOLA
● Live rate • Updates automatically

// Fetch live gold price
async function getGoldPrice() {
const apiKey = ‘YOUR_API_KEY’; // Get free key from goldapi.io
const apiUrl = https://www.goldapi.io/api/price/XAU/USD;

try {
const response = await fetch(apiUrl, {
method: ‘GET’,
headers: {
‘x-access-token’: apiKey
}
});const data = await response.json(); console.log(`Gold Price: $${data.price} per troy ounce`); console.log(`Timestamp: ${data.timestamp}`); // Display on website document.getElementById('gold-price').innerHTML = ` <h2>Gold Price (USD)</h2> <p>$${data.price} per troy ounce</p> <small>Updated: ${new Date(data.timestamp).toLocaleString()}</small> `; return data;

Error loading price’;
}
}

// Call function when page loads
document.addEventListener(‘DOMContentLoaded’, getGoldPrice);

// Refresh price every 60 seconds
setInterval(getGoldPrice, 60000);

} catch (error) {
console.error(‘Error fetching gold price:’, error);
document.getElementById(‘gold-price’).innerHTML = ‘