1 Reply Latest reply on Sep 19, 2009 1:30 AM by whistlerwebandprint

    Using CFHTTP to submit a form directly to a google docs form

    whistlerwebandprint Level 1

      Ok so here is some background


      Google has a service where you can create forms using google docs and embed them into your webpage, Results are automatically stored in a google spreadsheet upon submission.


      I want to use my own form to submit to to the google form processing page which I can get to work however the default generic google hosted thank you page appears upon submissing.


      I know you can use cfhttp to submit a form from a coldfusion server so I was thinking that I could simply pass my form variables to a action page that resubmitted them via cfhttp and thus bypass the thank you page altogether


      however when I try this it does not work and the results do not show up in the google spreadsheet. I figured that mabye the google processing page could tell that it was not submitted from a browser so I tired adding a useragent string but still no luck.


      Here is the code I was trying to use


      <cfhttp method="POST" url="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" redirect="yes" useragent="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)">
           <cfhttpparam type="Formfield" name="entry.0.single" value="testValue1" >
           <cfhttpparam type="Formfield" name="entry.1.single" value="testValue2" >


      And the online spread sheet can be viewed here

      http://spreadsheets.google.com/pub?key=tlo4FjygqMuUGmvuOb2_Gjw&single=true&gid=0&output=ht ml


      Does anyone know why this is not working?


      To recap I am able to use the following form on my own comptuer to directly submit to the processing page and this works

      <form action="https://spreadsheets.google.com/formResponse?key=tlo4FjygqMuUGmvuOb2_Gjw" method="POST">
      <input type="text" name="entry.0.single" value="" >
      <input type="text" name="entry.1.single" value="">
      <input type="submit" name="submit" value="Submit">


      Any help would be greatly appreciated