title: Transferring data to GAS via doPost does'nt work
body: <p>I want to submit some simple data from a php based database system to google apps engine via curl / doPost. The goal is that GAS executes the app as the user accessing the web app and that anyone (who has an google account) can access the app.</p>
  
  <p>On the PHP-System-side I've got the following code to SEND data:</p>
  
  <pre><code>// Get cURL resource
  // 
  $curl = curl_init();
  // Set some options
  curl_setopt_array($curl, array(
  CURLOPT_URL =&gt; 'https://script.google.com/macros/s/AKfycbw-BksmkTsn_KEX40EhzfEulE-rJsUmlbIjUtW9PrTRMQLyiA/exec',
  CURLOPT_POST =&gt; 1,
  CURLOPT_FOLLOWLOCATION =&gt; 1,
  CURLOPT_SSL_VERIFYPEER  =&gt; 1,
  CURLOPT_POSTFIELDS =&gt; array(
     'firstname' =&gt; 'John',
     'lastname' =&gt; 'Miller'
  )
  ));
  
  // Send the request, save response to $resp
  $resp = curl_exec($curl);
  //echo curl_error($curl);
  
  // Show response
  echo $resp;
  
  // Close request to clear up some resources
  curl_close($curl);
  //echo 'curl closed';
  </code></pre>
  
  <p>On the GAS-side I've got the following code to RECEIVE data:</p>
  
  <pre><code>function doPost(e) {
  
    var parameter
    var wert
  
    for (var i in e.parameter) {
      parameter = i;
      wert =  e.parameter[i];
  
      if (parameter == "firstname") {var firstname = wert;}    
      if (parameter == "lastname") {var lastname = wert;}
  
    }
  
  
    //Return  
    return ContentService.createTextOutput("The name is: " + firstname + " " + lastname);
  
  }
  </code></pre>
  
  <p>The code only works fine if the script in GAS is deployed with the following options: "Execute the app as:" is set to "Myself". "Who has access to the app" is set to "Anyone, Even Anonymous". If somebody wants to test the code, you also have to add some lines to your php.ini and save a "cacert.pem"-file on your computer:</p>
  
  <pre><code>[curl]
  curl.cainfo="C:/[path to]/cacert.pem"
  CURLOPT_SSL_VERIFYPEER=1
  </code></pre>
  
  <p>If I switch the deployment options "Execute the app as:" to "User accessing the web app" and "Who has access to the app" is to "Anyone" it doesn't work any more. The following appears on the screen:</p>
  
  <p>After sending the https-request via cURL to google apps script, a login-screen appears for user login to google. The tab in chrome is titled "Meet Google". It says "Sign in to continue to Google Drive". The whole login screen is in english language (I'm german). After that I'm entering login-information of my private google account and press "sign in"-button. After that a second login screen appears. The tab in chrome is titled "Google Drive". It says "Zur Nutzung von Google Drive anmelden" (translation: "please sign in to access google drive."). Then I'm typing in the same login information a second time and press the "anmelden"-button (translation: "sign in"). The next thing that happens is that the URL of the apps script appears in chrome. The tab is titled "Fehler" (translation: "Error"). In the window I can read "Skript-Funktion nicht gefunden: doGet" (translation: "Script function not found: doGet").</p>
  
  <p>I cannot understand the behavour of google apps script. Especially I can't understand why google asks for "doGet", although there definitely is a "doPost" in the apps script.</p>
  
  <p>Some help would be very welcome.</p>
  
  <hr>
  
  <p>Months later I'm still working on this issue.</p>
  
  <p>I created a project in google developers console and connected the apps script to this project.</p>
  
  <p>This way it's possible to access the logged in google users via google api calls from PHP. So I have to do all the coding in PHP. But this is not what I want.</p>
  
  <p>I want to access the currently logged in google users gmail / drive etc. via google apps script. I only want to transfer some data via PHP.</p>
  
  <p>After several hours of searching on the web it seems to me that this is unpossible.</p>
  
  <p>Any hint would be very welcome.</p>