title: Posting data to google apps script using php/curl
body: <p>I want to submit some simple data from a php based database system to google apps engine.</p>
  
  <p>The following code produces no error, but no result, too. I can't find out why google apps script does not react.</p>
  
  <p>The google apps script is configured for use by anybody who knows the url (anonymous user is allowed). The script will be executed by my account, even if it is triggered bei anonymous user. The apps script has all the rights it needs to work.</p>
  
  <p>The goal is that google apps script shows the posted data.</p>
  
  <p>Any help will be very welcome. Maybe there is another method to transfer the data to google apps script.
  I could'nt find a solution after several hours of searching and trying.</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/AKfycbykWm97cwsxoP6NGhub8AqGuQammVwCwVgJrxjFLxY8TAFGRw/exec',
  CURLOPT_POST =&gt; 1,
  CURLOPT_POSTFIELDS =&gt; array(
      'fname' =&gt; 'John',
      'lname' =&gt; 'Miller'
  )
  ));
  
  // Send the request, save response to $resp
  $resp = curl_exec($curl);
  
  // Show response
  echo $resp;
  
  // Close request to clear up some resources
  curl_close($curl);
  
  echo 'curl closed';
  </code></pre>
  
  <p>On the Google apps script-side I've got the following code to RECEIVE data:</p>
  
  <pre><code>// Show name in google apps
  
  
  function doPost(e) {
  
    var parameter
    var value
  
    for (var i in e.parameters) {
      parameter = i;
      wert =  e.parameters[i];
  
      if (parameter == "lname") {var lname = value;}    
      if (parameter == "fname") {var fname = value;}
  
    }
  
    //Return  
    return HtmlService.createHtmlOutput("The name is: " + fname + " " + lname)
  
  }
  </code></pre>