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

  • Home
  • SEARCH
  • 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 7651191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:26:43+00:00 2026-05-31T11:26:43+00:00

I am using CURL for get response from an web api. I am getting

  • 0

I am using CURL for get response from an web api. I am getting response but it is in string format like this:

HTTP/1.1 302 Moved Temporarily Date: Fri, 16 Mar 2012 12:57:16 GMT
Server: GlassFish/v3 X-Powered-By: Servlet/2.5 Location:
http://demo.tdsarena.com/tds/ Content-Type: text/html;
charset=iso-8859-1 Content-Length: 0 Set-Cookie:
JSESSIONID=b869884w3w3r3r76dbd1a2bfd5d; Path=/tds Vary:
Accept-Encoding Connection: close

i am using following code:

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'http://demo.tdsarena.com/tds/j_security_check');
curl_setopt($ch, CURLOPT_POST, true);

curl_setopt($ch, CURLOPT_POSTFIELDS, "j_username=XXX&j_password=XXX");

curl_setopt($ch, CURLOPT_HEADER, true);



curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);
curl_close($ch);

echo $result;

i want to get cookie “JSESSIONID”. but how can i get this. I have tried with $_COOKIE variable.

can anybody help me plz. thanks in advance.

  • 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-31T11:26:45+00:00Added an answer on May 31, 2026 at 11:26 am

    You could parse the $result value and extract the cookie value using something like this:

    if (preg_match('/Set-Cookie: JSESSIONID=(.*?);/', $result, $matches))
    {
        $cookieVal = $matches[1];
        echo $cookieVal;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a API to get some data from curl. Response i get
I am using curl like this: curl -s -F uploaded_file=@/path_to_file;type=text/html -F output=soap12 http://localhost/w3c-markup-validator/check >text.xml
I am using the CURL c++ api to get quotes from Yahoo's financial API.
I am using PHP curl method to get a string type response. To create
I'm using cURL to get the XML file for my Twitter friend's timeline. (API
I'm trying to get character data from www.wowarmory.com using PHP and cURL. The code
I'm using cURL to get a web page and present to our users. Things
I have this 'web service' I made that when accessed: http://192.168.0.1/api/v1/search/?query=thequery returns a JSON
Do anyone know how to get parameters' values from curl command in REST web
I'm sending a string of data via CURL using data from post, and receiving

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.