HTTP post from android to PHP not working
<p>I am trying to get a Android device to send some information to a local host. I believe I have the Android sending the information, but my PHP code is not accepting or not displaying the code. I have attached my code, is there something I have missed? I am running wamp server also, and have put the permissions into the manifest.</p>

<p>Java Code: #</p>

<pre><code>HttpPost httppost;

    HttpClient httpclient;

    // List with arameters and their values
    List&lt;NameValuePair&gt; nameValuePairs;

    String serverResponsePhrase;
    int serverStatusCode;
    String bytesSent;
    String serverURL = "http://10.0.2.2/test/index.php";


    httppost = new HttpPost(serverURL);
    httpclient = new DefaultHttpClient();
    nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);

    // Adding parameters to send to the HTTP server.
    nameValuePairs.add(new BasicNameValuePair("parameterName1", "git"));
    nameValuePairs.add(new BasicNameValuePair("parameterName2", "git"));

    // Send POST message with given parameters to the HTTP server.
    try {
        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        HttpResponse response = httpclient.execute(httppost);

        InputStream is = response.getEntity().getContent();
        BufferedInputStream bis = new BufferedInputStream(is);
        ByteArrayBuffer baf = new ByteArrayBuffer(20);

        int current = 0;
        while ((current = bis.read()) != -1) {
            baf.append((byte) current);
        }

        bytesSent = new String(baf.toByteArray());

        // Response from the server
        serverResponsePhrase = response.getStatusLine().getReasonPhrase();
        serverStatusCode = response.getStatusLine().getStatusCode();
        System.out.println("COMPLETE");
    } catch (Exception e) {
        // Exception handling
        System.out.println("Problem is " + e.toString());
    }
</code></pre>

<p>PHP Code:</p>

<pre><code>&lt;?php
echo "param1 value: ".$_POST['parameterName1']."\n";
echo "param2 value: ".$_POST['parameterName2']."\n";
?&gt;
</code></pre>

<p>I also tried this code, but it did not work with my PHP</p>

<pre><code>HttpPost httppost;

    HttpClient httpclient;

    // List with arameters and their values
    List&lt;NameValuePair&gt; nameValuePairs;

    String serverResponsePhrase;
    int serverStatusCode;
    String bytesSent;
    String serverURL = "http://10.0.2.2/test/index.php";


    httppost = new HttpPost(serverURL);
    httpclient = new DefaultHttpClient();
    nameValuePairs = new ArrayList&lt;NameValuePair&gt;(2);

    // Adding parameters to send to the HTTP server.
    nameValuePairs.add(new BasicNameValuePair("'parameterName1'", "git"));
    nameValuePairs.add(new BasicNameValuePair("'parameterName2'", "git"));

    // Send POST message with given parameters to the HTTP server.
    try {
        HttpEntity entity = new UrlEncodedFormEntity(nameValuePairs);

        httppost.addHeader(entity.getContentType());
        httppost.setEntity(entity);


        HttpResponse response = httpclient.execute(httppost);

        InputStream is = response.getEntity().getContent();
        BufferedInputStream bis = new BufferedInputStream(is);
        ByteArrayBuffer baf = new ByteArrayBuffer(20);

        int current = 0;
        while ((current = bis.read()) != -1) {
            baf.append((byte) current);
        }

        bytesSent = new String(baf.toByteArray());

        // Response from the server
        serverResponsePhrase = response.getStatusLine().getReasonPhrase();
        serverStatusCode = response.getStatusLine().getStatusCode();
        System.out.println("response" + response.toString());
        System.out.println("COMPLETE");
    } catch (Exception e) {
        // Exception handling
        System.out.println("Problem is " + e.toString());
    }
</code></pre>
