Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何用C语言填写Google表单#_C#_.net_Google Forms - Fatal编程技术网

C# 如何用C语言填写Google表单#

C# 如何用C语言填写Google表单#,c#,.net,google-forms,C#,.net,Google Forms,表单是多页的,如 我尝试使用POST请求,但它只适用于一页表单。也许还有其他方法?试试这段代码 WebClient client = new WebClient(); var nameValue = new NameValueCollection(); nameValue.Add("entry.xxx", "VALUE");// You will find these in name (not id) attributes of the input tags nameValue.Add("en

表单是多页的,如 我尝试使用POST请求,但它只适用于一页表单。也许还有其他方法?

试试这段代码

WebClient client = new WebClient();
var nameValue = new NameValueCollection();
nameValue.Add("entry.xxx", "VALUE");// You will find these in name (not id) attributes of the input tags 
nameValue.Add("entry.xxx", "VALUE");
nameValue.Add("entry.xxx", "VALUE");
nameValue.Add("entry.xxx", "VALUE");
nameValue.Add("pageHistory", "0,1,2");//Comma separated page indexes
Uri uri = new Uri("https://docs.google.com/forms/d/e/[FORM_ID]/formResponse");
byte[] response = client.UploadValues(uri, "POST", nameValue);
string result = Encoding.UTF8.GetString(response);
我试了3页。“我猜”你可以有任意数量的页面。 这将直接提交数据并返回“来自谷歌表单的成功页面”

编辑

我从来没有像“从来没有”那样使用过谷歌表单,所以没有找到一个合适的方法来实现这一点(如果有的话),但这似乎很好

将此附加到uri中以获得多个复选框

?entry.xxxx=Option+1&entry.xxxx=Option2 
entry.xxxx对于一个问题保持不变 如果您有多个带有复选框的问题,则会改为此

?entry.xxx=Option+1&entry.xxx=Option2&entry.zzz=Option+1&entry.zzz=Option2
值是复选框的标签
将(空白)替换为(+)加号(如果有)(选项1中的类似项)

Puneet的答案是我找到的关于如何处理多值复选框的唯一答案。我试图找到一种方法,将多个复选框值放在响应的主体中,而不是放在URL中,但没有找到

本着他的回答精神,我在C语言中创建了一个
GoogleFormSubmissionService
,以便在C语言中轻松处理Google表单


您可以在我的要点中找到它:

也许您还知道如何在一个问题中设置多个复选框?我正在努力使用无线电框而不是复选框。关于处理收音机有什么建议吗?我在这里问了我的问题:对不起@Hassanglzar,我没有任何必要处理单选按钮。