title: Android POST Request to PHP
body: <p>I try to develope an Android application. In this application, I need to send a POST request to a PHP page.</p>
  
  <p>My code is at Java side:</p>
  
  <pre><code> DefaultHttpClient httpclient = new DefaultHttpClient();
   HttpPost httppost = new HttpPost("http://localhost/get.php");
  
       ArrayList&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;();
       nameValuePairs.add(new BasicNameValuePair("mail", "asdasd"));
       httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
       try{
              HttpResponse httpresponse = httpclient.execute(httppost);
  
       }catch(Exception e){
           Toast.makeText(getApplicationContext(), "Didn't Happen",10).show();    
       }
  </code></pre>
  
  <p>Manifest.xml</p>
  
  <pre><code> &lt;?
  xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.misman"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17"/&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  
      &lt;application
          android:permission="android.permission.INTERNET"
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.misman.MainActivity"
              android:label="@string/app_name" &gt;
  
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I have searched from a lot of websites and the code goes in catch block continuously.I also used HttpURLConnection and didn't work. Can you help me what can be the problem?</p>