2

我正在尝试从我设备中的 C 程序将 HTTP 发布到谷歌表单。对于旧表单,活动表单提交 URL 如下所示。我使用这些文本进行了 URL 编码的 HTTP/1.1 POST,这很成功。

https://spreadsheets.google.com/formResponse?formkey=FORMKEY&ifq&entry.0.single=ENTRY1&entry.2.single=ENTRY2&submit=Submit

对于新的谷歌表单(无论您现在从谷歌驱动器创建哪个),下面是活动的提交 URL。当我将它用于 HTTP 发布时,我收到错误代码 400 的错误请求。

https://docs.google.com/forms/d/FORMKEY/formResponse?entry.1252261890=ENTRY1&entry.1890412746=ENTRY2

新旧谷歌表单之间有什么变化?我看到其他地方有人面临类似的问题,但到目前为止还没有解决方案。谢谢你的帮助。

4

1 回答 1

0

这是一个 javascript(谷歌应用程序脚本)POST,它正在处理当前表单(有一个字段!)也许你可以从中得到你需要的东西:

function sendHttpPost() {

var fish = "I am a mackerel";

   var payload =
   {
     "entry.2071121932" : fish

   };

   // Because payload is a JavaScript object, it will be interpreted as
   // an HTML form. (We do not need to specify contentType; it will
   // automatically default to either 'application/x-www-form-urlencoded'
   // or 'multipart/form-data')

   var options =
   {
     "method" : "POST",
     "payload" : payload,
      "muteHttpExceptions": true
   };

 var response =  UrlFetchApp.fetch("https://docs.google.com/forms/d/this is the form ... key/formResponse", options);

Logger.log(response.getContentText())
 }
于 2013-10-25T09:41:06.517 回答