English 中文(简体)
• 如何利用谷歌应用的文字来重塑成像和 co?
原标题:How to refresh the token and cookies using Google Apps Script?

我想在我每次利用谷歌应用文字提出请求时,自动填写verification tokenCookie? 我将Pin列入 http://web/a>,并将结果摘回谷歌,我使用了以下刀:

 function submitForm() {
  var url = "https://taxdelinquent.cookcountyclerkil.gov/";
  var formData = {
      __RequestVerificationToken :  q5mCwHyTYkN3HgYB3NZXS-JvsGLfvH5bmRtpJKPWTmml_Oskif_gIW3vnU8jNbhZC_XW2xlmCyGqHAhISUjtX-zbZdoIQBiOulF44suHU1c1 ,
     Pin :  13-30-300-016-0000 
  };

  var encodedData = Object.keys(formData).map(function(key) {
    return encodeURIComponent(key) +  =  + encodeURIComponent(formData[key]);
  }).join( & );

  var headers = {
    "Accept": "text/html,application/xhtml",
    "Cookie": "__RequestVerificationToken=wOpZrdbvOL7wiQJcqlWYSAlsLIBc5yImjoHSGqSixBZewlt2FZgNLQXh9xH5APz2_bCkcgxPmckSipc1sRExCbLEOYcmCRrWTqNhX8mVtqk1; AWSALB=KsF6dcBJ9rQjYyLrj1veloVO595F9XgoQyhW2wcXz8AC6XuxVBcklT3NdYfQ8p32s2w/pzyVw5w7QcJ7NBnAhb3LcpBoWAyN6hwsXjzXMvr4fZhbEZ4KAMXHjbU8; AWSALBCORS=KsF6dcBJ9rQjYyLrj1veloVO595F9XgoQyhW2wcXz8AC6XuxVBcklT3NdYfQ8p32s2w/pzyVw5w7QcJ7NBnAhb3LcpBoWAyN6hwsXjzXMvr4fZhbEZ4KAMXHjbU8"
  };

  var options = {
    "method": "post",  // or "get" depending on your needs
    "headers": headers,
    "payload": encodedData
  };

  var response = UrlFetchApp.fetch(url, options).getContentText();
}

它生成所需数据。 如欲上inspect content of this website,请参看有效载荷:

“Form

http://www.ohchr.org。 looks:

“Data

但 我相信,当这一“明星号”和“明星号”的交接期结束时,书面文本将无法获取数据,我需要你指导,才能解决。 谢谢你。

问题回答

ok,使用以下文字 我可以查阅<代码>对象征性和<代码>cookies,并在以上文字上加以使用:submitForm (:

function getTokenCookie(url) {

  var options = {
    "method": "get", 
  };

  // Make the HTTP request
  var response = UrlFetchApp.fetch(url, options);
  var cookies = response.getAllHeaders()["Set-Cookie"];

  var htmlContent = response.getContentText();
  var match = htmlContent.match(/<input name="__RequestVerificationToken" type="hidden" value="([^"]+)" />/);

  if (match && match.length > 1) {
    var verificationToken = match[1];
    return [verificationToken,cookies];
  } else {
    Logger.log("Unable to find __RequestVerificationToken in the HTML content.");
  }
}

该文字从网页上获取用于数据拆解的“(象征性的,cookies)”的数值。





相关问题
Dynamic creation of ASP.NET Form Elements

I m trying to build a form which generates itself as it is used. I have created a really simplistic example, loosely related to what I m trying to do below, but which demonstrates the problem. The ...

php Input field coming across as Integer

EDIT 2: After writing up an incredibly long explanation in more detail I, of course, discovered my problem and it had nothing to do with the question I asked. It was caused because I was creating a ...

IE7 onSubmit return false in function may fail?

I found this forum thread in google, but no one here seems to encounter the same problem, so I would like to know if onsubmit= return false; really fails in some IE7 browsers, meaning that it has ...

Required form field communication

I ve always communicated required form fields on web applications to users by hanging an asterisk off the end of the control or the label and having a little sentence along the lines of "required ...

WebForms and ASP.NET MVC co-existence

I am trying to make a WebForms project and ASP.NET MVC per this question. One of the things I ve done to make that happen is that I added a namespaces node to the WebForms web.config: <pages ...

Can the behaviour of new HTML5 form types be overridden?

I was wondering if anyone knew if it were possible to override the default behaviour of browsers that support the new HTML input types such as type="email" and type="date"? I appreciate that I could ...