Question

I'm trying to submit data to Google Forms, specifically to this form here. Here's the code that I'm trying to use to submit to the form. The code executes just fine, but I never see any data show up in the form. Furthermore, the post always returns a status code 200 (Checked later on in the code). Any ideas what I'm doing wrong here? Thanks!

HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("https://docs.google.com/forms/d/1EqlHV7Khlb-eONO0ffa_bXEMDcvIzXObt72pnydfW0o/formResponse");

List<BasicNameValuePair> results = new ArrayList<BasicNameValuePair>();
results.add(new BasicNameValuePair("entry.1840528687",gridSquare));
results.add(new BasicNameValuePair("entry.406732602",sourceDb));
results.add(new BasicNameValuePair("entry.369248655",errorType));
results.add(new BasicNameValuePair("entry_331766136",paidUserString));
results.add(new BasicNameValuePair("entry.240391797",version));
results.add(new BasicNameValuePair("draftResponse","[]\n"));
results.add(new BasicNameValuePair("pageHistory","0"));
results.add(new BasicNameValuePair("fbzx","1608817002751623479"));

post.setEntity(new UrlEncodedFormEntity(results));

HttpResponse response=client.execute(post);
Was it helpful?

Solution

It turns out I'm doing it exactly right, except that I was using the wrong values as inputs. Essentially I mixed sourceDb and errorType when I was setting them. To figure this out, I put the output into a simple web view, which when it executed showed me that the form didn't submit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top