title: Programmatically filling in a website form using MultipartEntity
body: <p>I'm taking a mobile development class, which focuses on Android, and for my term project I thought it would be cool if I made a little application that returns a list of cancer-related events and fundraisers.  Basically what I have to do is programmatically fill in a webform given criteria that is input from my application, and parse the returned results to give a list of events, because for some reason the American Cancer Society doesn't keep a public list of all events.  This is my first real experience with android, and I have almost zero experience with network programming.  If I really wanted to, I could just change the URL I go to based on the paramaters given to me, because the ACS event search URLs all look almost exactly the same, but I want to do it "right".  I looked at <a href="https://stackoverflow.com/questions/2304663/apache-httpclient-making-multipart-form-post" title="this post">this post</a> and <a href="https://stackoverflow.com/questions/5089891/android-video-upload-to-php-server">this one</a> for guidance, which led me to the MultipartEntity.  They've been very helpful, but I really am not sure what to do next.  Code is below:       </p>
  
  <pre><code>    //Base case, creates entity based on Entered ZIP Code
      public void sendRequest()
      {
          EditText MyEditText = (EditText)findViewById(R.id.zip_edit_text);
          String ZIP = MyEditText.getText().toString();
  
          HttpClient defaultClient = new DefaultHttpClient();
          HttpPost httppost = new HttpPost("http://www.cancer.org/Involved/Participate/app/event-search");
  
          try{
              MultipartEntity entity = new MultipartEntity();
              entity.addPart("ZIP",new StringBody(ZIP));
              httppost.setEntity(entity);
              HttpResponse response = defaultClient.execute(httppost);
              HttpEntity result = response.getEntity();
  
              InputStream stream = result.getContent();
              String s = new Scanner(stream).useDelimiter("\\A").next();
  
              Intent intent = new Intent(HomeScreen.this, ListResults.class);
              startActivity(intent);
              AlertDialog dialog = new AlertDialog.Builder(this).create();
              dialog.setMessage(s);
              dialog.show();
  
          }catch (ClientProtocolException e){
              e.printStackTrace();
          } catch (IOException e){
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>It's pretty bare-bones right now, as you can see.  The AlertDialog is used just to see what the HttpResponse looks like, and it seems like it does the POST correctly, and the ZIP code ends up in the right text field, but it doesn't actually "click" the search button.  Personally, I think either:
  1.) My HttpPost object's URL was incorrect
  2.) I used POST instead of GET, or i should POST then GET</p>
  
  <p>I really have tried to work this out myself, and have searched StackOverflow, but I've really come to a rough patch, and as I said before, my network programming experience is near nonexistent.  Any help would be appreciated.</p>