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 7438611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:34:54+00:00 2026-05-29T10:34:54+00:00

I want to get an .ics file from a webpage but there I need

  • 0

I want to get an .ics file from a webpage but there I need to login.
I’m able to login with the following code:

    DefaultHttpClient httpclient = new DefaultHttpClient();

    HttpGet httpget = new HttpGet("http://ipool.ba-berlin.de/stundenplaene.anzeige.php?faculty=15&course=6&type=html");

    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://ipool.ba-berlin.de/main.php?action=login");

    List<NameValuePair> nvps = new ArrayList<NameValuePair>();
    nvps.add(new BasicNameValuePair("FORM_LOGIN_NAME", "MY_USERNAME"));
    nvps.add(new BasicNameValuePair("FORM_LOGIN_PASS", "MY_PASSWORD"));

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

    response = httpclient.execute(httpost);
    entity = response.getEntity();

    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();

But after my login, I don’t know how to get the content of my file. How can I make it possible?

Thanks a lot!

  • 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-05-29T10:34:54+00:00Added an answer on May 29, 2026 at 10:34 am

    If i understand you question after login you should request resources (file url) with your session cookie.

    try something like this

    CookieStore cookieStore = new BasicCookieStore(); 
    BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", mySessionId);
    
    cookieStore.addCookie(cookie); 
    client.setCookieStore(cookieStore); 
    

    You have already managed to login, so you should have recieved session cookie in response,
    i see it in your code, now you have to make new http request to url where you file is, but server side need to validate that you are already logged in, so it stored data about you in session object based on id you have recieved in response as cookie named JSESSIONID , you need to pass that cookie together with new request, the example creates new cookie you can pass recieved cookie directly

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

Sidebar

Related Questions

I want get exeption code from wcf method but i always get NotFound error.
What I want: get a xml from the AppData to use What I code
I want get data from php with jquery.I wrote this code: <?php $return=array('content'=>1,'id'=>2,'priority'=>3); echo
I want get parameters from json, so I have a code: @RenderMode(name = VIEW)
I want get the image from an xml file which is encoded using base64.
I want get as much as possible from Redis + Hiredis + libevent. I'm
Basically I want get data I already have accessed from javascript and passing it
i want query a file xml with linq, i want get all descendat of
I want to get 100 and example from this string ?connect:100/username:example/ I searched in
I want to add events to my outlook calendar from the php code. As

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.