Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8039791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:41:19+00:00 2026-06-05T03:41:19+00:00

So I am trying to login to a website (in this example myspace) using

  • 0

So I am trying to login to a website (in this example myspace) using Apache’s HttpClient v.4 but I am not sure where I am going wrong in the process, when I test this code, the Post Login Cookies are the same as the Initial login cookies, but that shouldn’t be.

I have looked around online to see if anyone else has tried, but I haven’t found a good resource that has worked for me.

I am using this example: apache HttpClient to access facebook ( Facebook)

 try{
        DefaultHttpClient httpclient = new DefaultHttpClient();

        HttpGet httpget = new HttpGet("http://www.myspace.com/auth/form");

        HttpResponse response = httpclient.execute(httpget);
        HttpEntity entity = response.getEntity();

        System.out.println("Login form get: " + response.getStatusLine());
        if (entity != null) {
            entity.consumeContent();
        }
        System.out.println("Initial set of cookies:");
        List<Cookie> cookies = httpclient.getCookieStore().getCookies();
        if (cookies.isEmpty()) {
            System.out.println("None");
        } else {
            for (int i = 0; i < cookies.size(); i++) {
                System.out.println("- " + cookies.get(i).toString());
            }
        }

        HttpPost httpost = new HttpPost("http://www.myspace.com/auth/form");

        List <NameValuePair> nvps = new ArrayList <NameValuePair>();
        nvps.add(new BasicNameValuePair("email", "someEmail"));
        nvps.add(new BasicNameValuePair("password", "somePassword"));

        httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));

        response = httpclient.execute(httpost);
        entity = response.getEntity();
        //System.out.println("Double check we've got right page " + EntityUtils.toString(entity));

        System.out.println("Login form get: " + response.getStatusLine());
        if (entity != null) {
            entity.consumeContent();
        }

        System.out.println("Post logon cookies:");
        cookies = httpclient.getCookieStore().getCookies();
        if (cookies.isEmpty()) {
            System.out.println("None");
        } else {
            for (int i = 0; i < cookies.size(); i++) {
                System.out.println("- " + cookies.get(i).toString());
            }
        }
        httpclient.getConnectionManager().shutdown();
    }
    catch(Exception e){e.printStackTrace();}

Example cookie:

    [version: 0][name: MSCOUNTRY][value: US][domain: .myspace.com][path: /][expiry: Tue Jun 12 23:22:15 EDT 2012]
[version: 0][name: MSCulture][value: IP=XXX.XXX.XXXX&IPCulture=en-US&PreferredCulture=en-US&PreferredCulturePending=&Country=VVM=&ForcedExpiration=0&timeZone=0&myStuffDma=&myStuffMarket=&USRLOC=RandomUserLocString==&UserFirstVisit=1][domain: .myspace.com][path: /][expiry: Tue Jun 12 23:22:15 EDT 2012]
[version: 0][name: SessionDDF2][value: RandomStringHere==][domain: .myspace.com][path: /][expiry: Sat Jun 05 23:22:15 EDT 2032]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:41:23+00:00Added an answer on June 5, 2026 at 3:41 am

    Why do you think that the initial cookies and the post cookies should be different? The application server side assigns a set of cookies to the client and usually that stays the same throughout the session.

    The application server associates a set of attributes associated with the session (using cookies as a lookup), and that is what decides whether the session is ‘logged-in’ or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've found this login script and I'm trying to implement it into my website
I am trying to build openid login system for my website. To do this
I'm trying to login automatically in a website using Perl with WWW::Mechanize . What
I'm trying to implement a login system to sign into a website using public
We are trying to use curl in PHP5 to login to a website using
I am trying to log in a website using php via cURL. But the
I am trying to login to this website https://www.virginmobile.com.au programatically (on the right there
Im trying to allow users to login to a website by verifying if they
I am trying to let GoogleBot login to my website and bypass the authentication.
I'm trying to get a login on a website where it connects to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.