I was trying to perform basic authentication with twitter api and i was getting mixed responses.
On first attempt this after noon, i got 200 status message and i thought i should move on ahead to parsing the xml response.
But this evening i retried it again and get messages 400 and 401.
The following is the code i have written.
I did see Http Post Tutorial but could not find the specific packages in the docs and instead wrote the following using the api doc.
Using java Syntax Highlighting
- HttpClient client = new HttpClient();
- client.getParams().setParameter("http.useragent", "android Client");
- GetMethod method = new GetMethod(twitter_statustime_url);
- NameValuePair nvp1 = new NameValuePair("username",name);
- NameValuePair nvp2 = new NameValuePair("password",passw);
- method.setQueryString(new NameValuePair[]{nvp1,nvp2});
- method.setDoAuthentication(true);
- int result=0;
- try {
- result = client.executeMethod(method);
- } catch (HttpException e) {
- Toast.makeText(TwitterAppMain.this,
- "Result code " + e.getMessage(), 4000).show();
- } catch (IOException e) {
- Toast.makeText(TwitterAppMain.this,
- "Result code " + e.getMessage(), 4000).show();
- }
- Toast.makeText(TwitterAppMain.this,
- "Result code " + e.getMessage(), 4000).show();
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Any help would be appreciated.
Thank you.
~Adil



.