使用PHP,我在网站的页脚中加载脚本以进行分析跟踪。这段代码直到最近才起作用。然后有一天我在控制台中发现了以下错误:
GET http://api.hostip.info/get_html.php net::ERR_NAME_NOT_RESOLVED
我采取的步骤:
我的剧本中是否存在罪魁祸首我没有考虑到?
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.35.min.js"</script>
AWS.config.update({accessKeyId: '[redacted for security]', secretAccessKey: '[redacted for security]'});
var QUEUE_URL = 'https://sqs.us-east-1.amazonaws.com/[redacted for security]';
var sqs = new AWS.SQS({region : 'us-east-1'});
var d = new Date();
var ip = "::1";
if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest();
else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("GET","http://api.hostip.info/get_html.php",true);
xmlhttp.onload = function e() {
response = xmlhttp.responseText;
hostipInfo = response.split("\n");
for (i=0; hostipInfo.length > i; i++) {
ipAddress = hostipInfo[i].split(":");
if ( ipAddress[0] == "IP" ) {
ip = (ipAddress[1]).trim();
var clf = ip + ' - - [' + d.getTime() + '] "GET ' + window.location.pathname + ' HTTP/1.1" 200 - "-" "' + navigator.userAgent + '" ' + window.location.hostname;
var params = {
MessageBody: clf,
QueueUrl: QUEUE_URL
};
sqs.sendMessage(params, function(err,data){
if(err) console.log('error:',"Fail Send Message" + err);
else console.log('such wow');
});
console.log(clf);
}
}
}
xmlhttp.timeout = 3000;
xmlhttp.ontimeout = function () {
var ip = "::1";
var clf = ip + ' - - [' + d.getTime() + '] "GET ' + window.location.pathname + ' HTTP/1.1" 200 - "-" "' + navigator.userAgent + '"';
var params = {
MessageBody: JSON.stringify(clf),
QueueUrl: QUEUE_URL
};
sqs.sendMessage(params, function(err,data){
if(err) console.log('error:',"Fail Send Message" + err);
else console.log('such wow');
});
console.log(clf);
}
xmlhttp.send(null);
答案 0 :(得分:0)
看起来http://api.hostip.info/get_html.php
已关闭。在浏览器中打开页面,您将看到它无效。