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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:55:26+00:00 2026-05-27T00:55:26+00:00

I use an API that I first need to log in to and then

  • 0

I use an API that I first need to log in to and then I get access to view the nodes. These are the two urls that are used.

http://thewebpage.com/login.php?user=123&pass=123
http://thewebpage.com/get_nodes.php

The method im using to connect is the following

StreamConnection s = (StreamConnection)Connector.open(url);
InputStream input = s.openInputStream();

byte[] data = new byte[256];
int len = 0;
StringBuffer raw = new StringBuffer();

while( -1 != (len = input.read(data))) {
    raw.append(new String(data, 0, len));
}

response = raw.toString();

When I connect to login.php I get the response from the server that im logged in, but the problem is when I call get_nodes.php I get the response “please login” because the session isn’t stored.

Is there any way to solve this so I can access the nodes?
Thanks

  • 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-27T00:55:27+00:00Added an answer on May 27, 2026 at 12:55 am

    I finally solved it by saving the cookie data from the login and then put the cookie in the other http request like this

    Get cookie

    HttpConnection connection = (HttpConnection)Connector.open(loginUrl);
    String cookieData = connection.getHeaderField("Set-Cookie");
    

    Set cookie

    HttpConnection connection = (HttpConnection)Connector.open(nodeUrl);
    connection.setRequestProperty("Cookie", cookieData);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create an API that will allow my customer's developers to use
So Google Analytics does not have an API that we can use to get
I use an API that expects a SQL string. I take a user input,
Can anyone recommend a simple API that will allow me to use read a
I would like to use the API to return all tweets that match my
What are some platform-specific API's that web browsers use to securely save passwords with
I'm making use of an API on the internet that is marshalling objects to
I'm trying to use Google Analytics API to query internal searches that happen on
I've found a few tutorials that explain how to use the windows API to
I know that is better to use Python to call Posix and Win API,

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.