需要帮助从 API 获得响应

问题描述

我通过将它从 curl 转换成这个 XHR 请求。 curl 请求有效,但无法使这个请求有效。请帮忙。

var url = "https://networkappers.com/api/port.PHP?ip=172.217.13.238&port=80";

var xhr = new XMLHttpRequest();
xhr.open("GET",url);

xhr.setRequestHeader("Cache-Control","no-cache");
xhr.setRequestHeader("Referer","https://www.networkappers.com/tools/open-port-checker");

xhr.onreadystatechange = function() {
  if (xhr.readyState === 4) {
    console.log(xhr.status);
    console.log(xhr.responseText);
  }
};

xhr.send();

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)