Also ensure that your Android manifest file has the INTERNET permission.
- Sunit

On Thu, Oct 30, 2008 at 6:42 AM, AnuR <[EMAIL PROTECTED]> wrote:

>
> Hi frnds,
>
> my application needs to login to a web site thru the application. How
> can i do it?
>
> for that I need to post the username ,password and some other data to
> the url.
> the code is as follows. I am using SDK 1.0
>
> DefaultHttpClient httpclient = new DefaultHttpClient();
>  HttpPost httpost = new HttpPost("my url to submit");
>  List <NameValuePair> nvps = new ArrayList <NameValuePair>();
>        nvps.add(new BasicNameValuePair("user_name", "myusername"));
>        nvps.add(new BasicNameValuePair("password", "mypassword"));
>        nvps.add(new BasicNameValuePair("hidden_data_to_post", "data
> to post"));
> httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
>  response = httpclient.execute(httpost);
>
>
> if I execute this code , I will get an error:
>
> Exception in thread "main" java.lang.RuntimeException: Stub!
>
> with error in the line
>
> DefaultHttpClient httpclient = new DefaultHttpClient();
>
>
> So what may be the probelm.If I am wrng pls help me with sample code
> for logging into a website in SDK 1.0
>
> if I use
> HttpClient client = new HttpClient();
>
>  try{
>    method = new PostMethod("https://my url to post");
>  method.addParameter("user_name", "myusername"));
>    method.addParameter("password", "mypassword"));
>    method.addParameter("hidden_data_to_post", "data to post"));
>    method.setFollowRedirects(false);
>  client.executeMethod(method);
>
> the response body will be 405 error
>
>
> if I set the
> >
>


-- 
- Sunit Katkar

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to