title: Curl and Google Forms
body: <p>I am making the PHP script that will automatically fill Google Forms document. I am doing with Curl.However, there problems with correctness of work this script</p>
  
  <pre><code>$text="forTestOnly";
  if( $curl = curl_init() ){
    curl_setopt($curl,CURLOPT_URL,'https://docs.google.com/forms/d/1bJXxSXzIkm7NtDCZXE4J3VF5UugVm4B_qTFuGFp1bKE/viewform');
    curl_setopt($curl, CURLOPT_COOKIESESSION, TRUE);
    curl_setopt($curl, CURLOPT_COOKIEFILE, "cookiefile");
    curl_setopt($curl,CURLOPT_RETURNTRANSFER,true);
    curl_setopt($curl,CURLOPT_ENCODING,'gzip,deflate');
    curl_setopt($curl,CURLOPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
    curl_setopt($curl,CURLOPT_HEADER,true);
    if( $html = curl_exec($curl) ){
       curl_setopt($curl,CURLOPT_URL,'https://docs.google.com/forms/d/1bJXxSXzIkm7NtDCZXE4J3VF5UugVm4B_qTFuGFp1bKE/viewform');
       curl_setopt($curl,CURLOPT_POST,TRUE);
       curl_setopt($curl,CURLOPT_POSTFIELDS,"entry.867207060=$text&amp;submit=ok");
       $out = curl_exec($curl);
       echo $out;
    }
    curl_close($curl);
   }
  </code></pre>
  
  <p>It gives such error:<strong>"HTTP/1.1 405 Method Not Allowed"</strong>. What is the problem?</p>
  
  <p>With regards</p>
  
  <p><a href="https://docs.google.com/forms/d/1bJXxSXzIkm7NtDCZXE4J3VF5UugVm4B_qTFuGFp1bKE/viewform" rel="nofollow">Link</a>  </p>
  
  <hr>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Problem was not in the settings of <strong>Curl</strong>(POST) but the <strong>URL</strong> I provided was incorrect.</p>