Cannot populate spinner from remote database
<p>Another Android beginner here!</p>

<p>Ok, I derped when using Toast to help me check for errors. I'm getting a 403 forbidden error, and I don't know what's causing it. The url is correct, since another function of mine returns data from the database.</p>

<pre><code>public class FillKeg extends Activity {

    Spinner spinBeerList;
    ArrayList&lt;String&gt; BeerList;
    ArrayAdapter&lt;String&gt; adapter;

    JSONArray jArray;
    String result = null;
    InputStream is = null;
    StringBuilder sb = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fillkeg);
        spinBeerList = (Spinner)findViewById(R.id.spinBeerList);
        BeerList = new ArrayList&lt;String&gt;();
        new getBeerList().execute("http://*****/kegdroid/getBeerList.php");
        adapter = new ArrayAdapter&lt;String&gt;(this,
            android.R.layout.simple_spinner_item, BeerList);    
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        spinBeerList.setAdapter(adapter);
    }

    private class getBeerList extends AsyncTask&lt;String, Void, String&gt; {

        protected String doInBackground(String... urls) {
            //http post
            for (String url : urls) {
                DefaultHttpClient httpclient = new DefaultHttpClient();
                HttpPost httppost = new HttpPost(url);
                try{
                    HttpResponse response = httpclient.execute(httppost);
                    HttpEntity entity = response.getEntity();
                    is = entity.getContent();

                    BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
                    sb = new StringBuilder();
                    sb.append(reader.readLine() + "\n");

                    String line = "0";
                    while ((line = reader.readLine()) != null) {
                            sb.append(line + "\n");
                    }
                    is.close();
                    result = sb.toString();
                }
                catch(Exception e){
                    Log.e("log_tag", "Error in http connection" + e.toString());
                }
            }
            return result;
        }

        protected void onPostExecute(String result){
            try{
                jArray = new JSONArray(result);
                JSONObject json_data = null;
                for(int i = 0; i &lt; jArray.length(); i++){
                    json_data = jArray.getJSONObject(i);
                    BeerList.add(json_data.getString("ContentsName"));
                }    
            }
            catch(JSONException ex){
                ex.printStackTrace();
            } 
            catch (ParseException ex) {
                ex.printStackTrace();
            }
        }

    }
}
</code></pre>
