【问题标题】:HTTP POST to google form C programHTTP POST 到谷歌表单 C 程序
【发布时间】:2013-10-10 23:35:00
【问题描述】:

我正在尝试通过我设备中的 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

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

【问题讨论】:

    标签: c http-post google-forms


    【解决方案1】:

    这是一个 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-08-07
      • 2019-09-14
      • 1970-01-01
      • 1970-01-01
      • 2015-08-22
      • 2012-03-08
      • 2016-03-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多