我从以下函数中收到“意外错误”:
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();
- 我可以使用其他脚本语言(例如 python)以编程方式获取 URL
- 我尝试在浏览器中获取 URL,结果成功
- 我可以成功从 Google Apps 脚本中获取“http://www.google.com ”
- 我在 Chrome 中导航到该网址时收到以下警告,这可能与该问题有关吗?
任何帮助表示赞赏 谢谢
最佳答案
不受信任的证书的最后一点是这里的重要线索。似乎与“help.tradingtechnologies.com”关联的 SSL 证书无效或由 Google 数据中心(UrlFetch 调用的发起地)的受信任 CA 签名。
要解决此问题,请尝试使用这行代码而不是 UrlFetch 调用。请注意 validateHttpsCertificates
记录的附加选项 here .
var response = UrlFetchApp.fetch(url, {'validateHttpsCertificates':false}).getContentText();
关于google-apps-script - Google Apps 脚本提取出现意外错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13508326/