Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为什么我使用AWS SDK的分析跟踪代码不再工作?_Javascript_Xmlhttprequest_Aws Sdk_Amazon Sqs - Fatal编程技术网

Javascript 为什么我使用AWS SDK的分析跟踪代码不再工作?

Javascript 为什么我使用AWS SDK的分析跟踪代码不再工作?,javascript,xmlhttprequest,aws-sdk,amazon-sqs,Javascript,Xmlhttprequest,Aws Sdk,Amazon Sqs,使用PHP,我在网站的页脚中加载了一个脚本,用于分析跟踪。直到最近,这段代码还在运行。然后有一天,我注意到我的控制台出现了以下错误: GEThttp://api.hostip.info/get_html.php net::错误名称未解析 我已采取的步骤: 尝试更新SDK的JS版本(我加载的是v2.1.35,而当前版本是v.2.2.32)。但这种做法是一条死胡同 考虑到控制台错误的细节,我认为问题可能涉及使用GET请求,因为这是一个似乎不再存在的页面。但同样,没有运气 我的剧本里有没有我没有解释的

使用PHP,我在网站的页脚中加载了一个脚本,用于分析跟踪。直到最近,这段代码还在运行。然后有一天,我注意到我的控制台出现了以下错误:

GEThttp://api.hostip.info/get_html.php net::错误名称未解析

我已采取的步骤:

  • 尝试更新SDK的JS版本(我加载的是v2.1.35,而当前版本是v.2.2.32)。但这种做法是一条死胡同
  • 考虑到控制台错误的细节,我认为问题可能涉及使用GET请求,因为这是一个似乎不再存在的页面。但同样,没有运气
  • 我的剧本里有没有我没有解释的罪魁祸首


    看起来像
    http://api.hostip.info/get_html.php
    已关闭。在浏览器中打开该页,您将看到它不工作

      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);