cURL / Mailing Lists / curl-library / Single Mail

curl-library

A sample to login and maintain session

From: Aditya Kumar Gupta <adityagupta.18_at_gmail.com>
Date: Mon, 15 Jun 2009 16:28:20 +0530

Hi

I am new to libcURL.

I have written an application in C and I am using it to login into a website
and request a few details from it. The url is a website which uses web
services and communicates in JSON format.
Basically there are two operations where first being the login and second
being the request for some data. Both the forms are on https and are part of
a java service which communicates in JSON format. While I am able to login
to the url and I get a success message as 200 OK. It also gives me a
JSESSIONID. I have enabled the cookie engine by calling
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""). When I try to connect to
the second url, and POST data to it, it redirects me to a new page stating
that the access is unautorized. I am not sure how to send the JSESSIONID
received from the first(/login) url to the second url. Can anyone please
help me by writing a small example for the same.

Thanks
Received on 2009-06-15