Open your Google Drive and create a new form:
Skip the Wizard and dive straight into building your form:
Add a couple of fields to your form.
To create the Spreadsheet where your form data will be stored:
Create a new spreadsheet for the results:
Open the form in Firefox and open the Web Inspector to "Network" and populate the form:
Submit the form with dummy data.
After you click Submit
on the form, you will see the request(s)
being sent to the server, the main one you're interested in
is the POST
request which sends the form data to Google.
Right-click on the POST
row in the "Network" inspector then click on "Copy as cURL" to get the code you will need to Submit the form from your command line.
curl 'https://docs.google.com/forms/d/1qwGbbUAT1yPZ-yVqXzIg8h0PGW281srrkBtCdJwFgdA/formResponse' \
-H 'Host: docs.google.com' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:41.0) Gecko/20100101 Firefox/41.0' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
-H 'Accept-Language: en-US,en;q=0.5' --compressed \
-H 'Referer: https://docs.google.com/forms/d/1qwGbbUAT1yPZ-yVqXzIg8h0PGW281srrkBtCdJwFgdA/viewform?fbzx=-4417037870062614176' \
-H 'Cookie: S=spreadsheet_forms=QDGgsetEGofY8ACPHHufQw; NID=71=Remk3p7UeYnI01GsXgQ3acVcBgiN8iKiBVrXK9GdwVnop4j9kaBDSWlxWl1vuvTKPdrK66DdXWRFTFo-2Onj0zUyCaJ1xfMACh8hTUb0XBIVYdVJdkr1jvvmlkhZVAkgbow9Scr_X17OI-M9tw4evTQHJ4tU6P7xM695WlCtODmubmt57QgkpTAXNwdZrQ05GqRhWfw; PREF=ID=1111111111111111:FF=0:TM=1442226709:LM=1442226709:V=1:S=es4FGMNhg_KRMNf0; OGP=-5061451:' \
-H 'Connection: keep-alive' \
--data 'entry.507774908=23&entry.241430440=tesa&entry.335159234=Female&draftResponse=%5B%2C%2C%22-4417037870062614176%22%5D%0D%0A&pageHistory=0&fvv=0&fbzx=-4417037870062614176'
Go back to the Google Spreadsheet you created in Step 5 above.
The data is exactly as we submitted it in the Google Form in Step 6.
Paste the cURL command you copied from FireFox into your terminal and hit the enter key:
built a basic HTML form with the same fields as the Google Form:
tried to submit the form using JQuery Ajax directly to google but this was rejected because of CORS...
We can either attempt to get JQuery to set the correct headers for this or...
### 11. Use an iFrame ?
Still have the same CORS issue ... need to re-think this.
- Record HTTP Form
POST
: https://stackoverflow.com/questions/5119861/record-http-form-posts-via-a-browser - Firefox copy cURL Command: https://hacks.mozilla.org/2013/08/firebug-1-12-new-features/#copyAsCURL
- Add headers to JQuery Ajax request: https://stackoverflow.com/questions/10093053/add-header-in-ajax-request-with-jquery
- CORS info: https://stackoverflow.com/questions/24371734/firefox-cors-request-giving-cross-origin-request-blocked-despite-headers
- CORS is is meant to block this... https://stackoverflow.com/questions/23607901/cross-origin-request-blocked-on