2

我从以下函数中得到“意外错误”:

function getBomgarFeedbackXML(){
  var url = "https://help.tradingtechnologies.com/api/reporting.ns?" + 
            "username=xxxxxx&password=xxxxxx&generate_report=SupportCustExitSurvey&" + 
            "start_date=2000-01-01&duration=0&report_type=rep&id=all";
  var response = UrlFetchApp.fetch(url).getContentText();
  Logger.log(response);
  return(Xml.parse(response, true));
}

导致错误的行是:

var response = UrlFetchApp.fetch(url).getContentText();
  1. 我可以使用其他脚本语言(例如 python)以编程方式获取 URL
  2. 我已经尝试在我的浏览器中获取我能够成功完成的 URL
  3. 我可以从 Google Apps 脚本中成功获取“ http://www.google.com ”
  4. 导航到 chrome 中的 URL 时收到以下警告,这可能与问题有关吗?

警告信息

感谢任何帮助谢谢

4

1 回答 1

2

不受信任的证书的最后一点是这里的重要线索。似乎与“help.tradingtechnologies.com”相关联的 SSL 证书无效或由受信任的 CA 根据 Google 数据中心(来自 UrlFetch 调用的来源)签署。

要解决此问题,请尝试使用这行代码而不是 UrlFetch 调用。请注意此处validateHttpsCertificates记录的附加选项。

var response = UrlFetchApp.fetch(url, {'validateHttpsCertificates':false}).getContentText();
于 2012-11-22T15:34:35.323 回答