title: Sending GPS data to server not working?
body: <p>I'm trying to send GPS data from android phone to server. Its not working though. I've attached my code snippet here. Kindly check it and help me with this!</p>
  
  <pre><code>public void onNmeaReceived(long timestamp, String nmea) 
      { 
          String url = "http://www.xyz.com/server.php?DATA=";
          String params = URLEncoder.encode(nmea);
          url = url+params;
          HttpClient client = new DefaultHttpClient();
          HttpPost httppost = new HttpPost(url);
          try {
              HttpResponse httpResponse = client.execute(httppost);
              Log.d("Status", "Request Sent " + httpResponse.getStatusLine().getStatusCode());
              } 
          catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
              } 
              Log.d("url", url);          
      }
  </code></pre>
  
  <p>My output is like this! Its getting encoded and sent.</p>
  
  <pre><code>08-03 22:37:01.062: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPGSV%2C4%2C1%2C16%2C03%2C14%2C147%2C%2C06%2C05%2C140%2C%2C09%2C05%2C018%2C%2C11%2C73%2C251%2C*7E%0D%0A
  08-03 22:37:01.172: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPGSV%2C4%2C2%2C16%2C14%2C29%2C085%2C%2C17%2C%2C%2C%2C18%2C%2C%2C%2C19%2C48%2C147%2C*72%0D%0A
  08-03 22:37:01.312: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPGSV%2C4%2C3%2C16%2C20%2C14%2C213%2C%2C22%2C29%2C056%2C%2C24%2C57%2C260%2C%2C27%2C07%2C001%2C*75%0D%0A
  08-03 22:37:01.432: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPGSV%2C4%2C4%2C16%2C28%2C32%2C298%2C%2C32%2C36%2C194%2C%2C08%2C%2C%2C%2C31%2C%2C%2C*74%0D%0A
  08-03 22:37:01.582: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPGGA%2C%2C%2C%2C%2C%2C0%2C%2C%2C%2C%2C%2C%2C%2C*66%0D%0A
  08-03 22:37:01.702: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPVTG%2C%2CT%2C%2CM%2C%2CN%2C%2CK%2CN*2C%0D%0A
  08-03 22:37:01.848: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPRMC%2C%2CV%2C%2C%2C%2C%2C%2C%2C%2C%2C%2CN*53%0D%0A
  08-03 22:37:01.962: DEBUG/url(15874): http://www.xyz.com/server.php?DATA=%24GPGSA%2CA%2C1%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C*1E%0D%0A
  </code></pre>
  
  <p>data sent to server is,</p>
  
  <pre><code>http://www.xyz.com/server.php?DATA=%24GPGSA%2CA%2C1%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C%2C*1E%0D%0A
  </code></pre>
  
  <p>Data is sent to server. the new1.nmea file is created! but when I put 'cat' to see whats inside, the file is empty!</p>
  
  <p>server.php</p>
  
  <pre><code>&lt;?php 
  //$data = $_POST["DATA"].""; 
  $data = file_get_contents('php://input');
  $Handle = fopen("/xxx/xxx/new1.nmea", "a");
  fwrite($Handle, $data);
  fclose($Handle);
  ?&gt;
  </code></pre>
  
  <p>I need the data in the same format at the server side without any changes(nmea 0183 format). I'm struck! please help me with this!</p>