PHP cannot receive a String from Android
<p>The following code attempts to POST a String from Android to PHP.</p>

<ul>
<li>INTERNET permission is given.</li>
<li>Shark has been checked.</li>
<li>the device connects to MAMP (WAMP for MAC) server and sends the String.</li>
</ul>

<p>Code on Android:</p>

<pre><code>HttpClient httpclient = new DefaultHttpClient();
HttpPost post = new HttpPost("http://MAMP-SERVER/post.php");

try {
    // Add your data
    List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1);
    nameValuePairs.add(new BasicNameValuePair("username", "Andro"));
    post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

    // Execute HTTP Post Request
    httpclient.execute(post);
    Log.i("POSTED", "YOUR USERNAME");

} catch (ClientProtocolException e) {
    Log.e("Client Protocol Exception", "Err "+ e.getMessage());
} catch (IOException e) {
    Log.e("IO Exception","Err "+ e.getMessage());
}
</code></pre>

<p>Code on PHP:</p>

<pre><code>$test=$_REQUEST["username"];  print $_REQUEST["username"]; 
</code></pre>
