Android app sends data to PHP script - Expectation failed
<p>I try to develop an app which needs to send data to a MySql database.
In order to achieve it, I create a httppost as follows</p>

<pre><code>public void postData() {    
     try {
       // Create a new HttpClient and Post Header 
      HttpClient httpclient = new DefaultHttpClient();  
      HttpPost httppost = new HttpPost("myscript.php");  
   // Add your data 
         List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();  
         nameValuePairs.add(new BasicNameValuePair("name", "Noon"));  
         nameValuePairs.add(new BasicNameValuePair("level", "0"));  
         httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));  

         // Execute HTTP Post Request  
         HttpResponse response = httpclient.execute(httppost);           
         String text = EntityUtils.toString(response.getEntity());          
            Log.i("","response = "+text); 
     } catch (ClientProtocolException e) {  
         // TODO Auto-generated catch block 
      e.printStackTrace();
     } catch (IOException e) {  
         // TODO Auto-generated catch block  
      e.printStackTrace();
     }  
 }   
</code></pre>

<p>On my server, I have the following script:</p>

<pre><code>&lt;?php
$link = mysql_connect("localhost", "user", "password")
    or die("Impossible de se connecter : " . mysql_error());
echo 'Connected';

$db_selected = mysql_select_db('db', $link);
if (!$db_selected) {
   die ('Impossible de sélectionner la base de données : ' . mysql_error());
}
mysql_query("INSERT INTO players (name, level) VALUES ('".$_REQUEST['name']."', '".$_REQUEST['level']."')");
mysql_close($link);
?&gt;
</code></pre>

<p>The string text is filled with error 417 - expectation failed.</p>

<p>I understand the problem but does not understand how to fix it.
I would appreciate your help on this issue as I am a bit stuck.</p>
