DmitrMakeev commited on
Commit
7119ca7
1 Parent(s): cc5f9f7

Update ver2.html

Browse files
Files changed (1) hide show
  1. ver2.html +42 -45
ver2.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Phone Verification</title>
7
  <style>
8
  body {
9
  font-family: Arial, sans-serif;
@@ -19,10 +19,13 @@
19
  margin: 0;
20
  border-bottom: 2px solid #388E3C;
21
  }
 
 
 
 
22
  #progressBar {
23
  width: 100%;
24
  background-color: #ddd;
25
- margin-top: 20px;
26
  }
27
  #progress {
28
  width: 0%;
@@ -32,45 +35,49 @@
32
  line-height: 30px;
33
  color: white;
34
  }
35
- #fileInput, #verifyButton {
36
  margin-top: 20px;
37
- padding: 10px 20px;
38
  font-size: 16px;
39
- color: white;
40
- background-color: #4CAF50;
41
- border: none;
42
- cursor: pointer;
43
  border-radius: 5px;
44
  }
45
- #verifyButton:hover, #fileInput:hover {
46
- background-color: #388E3C;
47
- }
48
- #downloadLink {
49
- display: inline-block;
50
- margin-top: 20px;
51
- padding: 10px 20px;
52
- font-size: 16px;
53
  color: white;
54
  background-color: #4CAF50;
55
- text-decoration: none;
56
- border-radius: 5px;
57
  }
58
- #downloadLink:hover {
59
  background-color: #388E3C;
60
  }
61
  </style>
62
  </head>
63
  <body>
64
- <h1>Phone Verification</h1>
65
- <div id="progressBar">
66
- <div id="progress">0%</div>
 
 
 
 
67
  </div>
68
  <input type="file" id="fileInput" accept=".txt">
69
- <button id="verifyButton">Verify Phones</button>
70
- <a id="downloadLink" style="display: none;">Download Verified Phones</a>
71
 
72
  <script>
73
- document.getElementById('verifyButton').addEventListener('click', function() {
 
 
 
 
 
 
 
 
 
 
 
74
  const fileInput = document.getElementById('fileInput');
75
  const file = fileInput.files[0];
76
  if (!file) {
@@ -82,36 +89,34 @@
82
  reader.onload = function(event) {
83
  const text = event.target.result;
84
  const phones = text.split('\n').map(phone => phone.trim()).filter(phone => phone);
85
- verifyPhones(phones, 1000); // 1000 миллисекунд (1 секунда) задержка
86
  };
87
  reader.readAsText(file);
88
  });
89
 
90
- async function verifyPhones(phones, delay) {
91
  const totalPhones = phones.length;
92
  const progressBar = document.getElementById('progress');
93
  const progressText = document.getElementById('progress').textContent;
94
- const verifiedPhones = [];
95
 
96
  for (let i = 0; i < totalPhones; i++) {
97
  const phone = phones[i];
98
  try {
99
- const response = await fetch('https://api.green-api.com/waInstance1101952913/checkWhatsapp/fb4986a9d9cb40ef9be6c7b08cb9c98b7a3b1dc8c6834b0b92', {
100
  method: 'POST',
101
  headers: {
102
  'Content-Type': 'application/json'
103
  },
104
- body: JSON.stringify({ phoneNumber: phone })
 
 
 
 
105
  });
106
  const data = await response.json();
107
- if (data.existsWhatsapp) {
108
- console.log(`Phone ${phone} exists in WhatsApp.`);
109
- verifiedPhones.push(phone);
110
- } else {
111
- console.log(`Phone ${phone} does not exist in WhatsApp.`);
112
- }
113
  } catch (error) {
114
- console.error(`Error verifying phone ${phone}:`, error);
115
  }
116
 
117
  const progress = ((i + 1) / totalPhones) * 100;
@@ -122,14 +127,6 @@
122
  await new Promise(resolve => setTimeout(resolve, delay));
123
  }
124
  }
125
-
126
- const verifiedText = verifiedPhones.join('\n');
127
- const blob = new Blob([verifiedText], { type: 'text/plain' });
128
- const url = URL.createObjectURL(blob);
129
- const downloadLink = document.getElementById('downloadLink');
130
- downloadLink.href = url;
131
- downloadLink.download = 'verified_phones.txt';
132
- downloadLink.style.display = 'inline-block';
133
  }
134
  </script>
135
  </body>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Send Messages</title>
7
  <style>
8
  body {
9
  font-family: Arial, sans-serif;
 
19
  margin: 0;
20
  border-bottom: 2px solid #388E3C;
21
  }
22
+ #progressBarContainer {
23
+ width: 80%;
24
+ margin: 20px auto;
25
+ }
26
  #progressBar {
27
  width: 100%;
28
  background-color: #ddd;
 
29
  }
30
  #progress {
31
  width: 0%;
 
35
  line-height: 30px;
36
  color: white;
37
  }
38
+ #apiKeyInput, #messageInput, #fileInput, #sendButton {
39
  margin-top: 20px;
40
+ padding: 10px;
41
  font-size: 16px;
42
+ border: 1px solid #ccc;
 
 
 
43
  border-radius: 5px;
44
  }
45
+ #sendButton {
 
 
 
 
 
 
 
46
  color: white;
47
  background-color: #4CAF50;
48
+ border: none;
49
+ cursor: pointer;
50
  }
51
+ #sendButton:hover {
52
  background-color: #388E3C;
53
  }
54
  </style>
55
  </head>
56
  <body>
57
+ <h1>Send Messages</h1>
58
+ <input type="text" id="apiKeyInput" placeholder="Enter API Key">
59
+ <input type="text" id="messageInput" placeholder="Enter Message">
60
+ <div id="progressBarContainer">
61
+ <div id="progressBar">
62
+ <div id="progress">0%</div>
63
+ </div>
64
  </div>
65
  <input type="file" id="fileInput" accept=".txt">
66
+ <button id="sendButton">Send Messages</button>
 
67
 
68
  <script>
69
+ document.getElementById('sendButton').addEventListener('click', function() {
70
+ const apiKey = document.getElementById('apiKeyInput').value;
71
+ const message = document.getElementById('messageInput').value;
72
+ if (!apiKey) {
73
+ alert('Please enter your API key.');
74
+ return;
75
+ }
76
+ if (!message) {
77
+ alert('Please enter a message.');
78
+ return;
79
+ }
80
+
81
  const fileInput = document.getElementById('fileInput');
82
  const file = fileInput.files[0];
83
  if (!file) {
 
89
  reader.onload = function(event) {
90
  const text = event.target.result;
91
  const phones = text.split('\n').map(phone => phone.trim()).filter(phone => phone);
92
+ sendMessages(phones, apiKey, message, 1000); // 1000 миллисекунд (1 секунда) задержка
93
  };
94
  reader.readAsText(file);
95
  });
96
 
97
+ async function sendMessages(phones, apiKey, message, delay) {
98
  const totalPhones = phones.length;
99
  const progressBar = document.getElementById('progress');
100
  const progressText = document.getElementById('progress').textContent;
 
101
 
102
  for (let i = 0; i < totalPhones; i++) {
103
  const phone = phones[i];
104
  try {
105
+ const response = await fetch(`https://api.green-api.com/waInstance1101952913/sendMessage/${apiKey}`, {
106
  method: 'POST',
107
  headers: {
108
  'Content-Type': 'application/json'
109
  },
110
+ body: JSON.stringify({
111
+ chatId: `${phone}@c.us`,
112
+ message: message,
113
+ linkPreview: true
114
+ })
115
  });
116
  const data = await response.json();
117
+ console.log(`Message sent to ${phone}:`, data);
 
 
 
 
 
118
  } catch (error) {
119
+ console.error(`Error sending message to ${phone}:`, error);
120
  }
121
 
122
  const progress = ((i + 1) / totalPhones) * 100;
 
127
  await new Promise(resolve => setTimeout(resolve, delay));
128
  }
129
  }
 
 
 
 
 
 
 
 
130
  }
131
  </script>
132
  </body>