curl-library
Question on using cURL in java...
Date: Tue, 22 Feb 2005 14:35:01 -0800
Hi,
I'm new to cURL in general, and I'm not good with C. I'm trying to use
javacurl to post simple data (a secure login page) over https but
failed. From the verbose printout of cURL, it seems that there is a
certificate verification failure and the error page returned from the
server suggests the user to accept cookies. I'm assuming that I'm not
setting the cookies configuration correctly, though I thought that cURL
manages cookies and sessions internally. Below is my code snippet:
CurlGlue cg = new CurlGlue();
cg.setopt(CURL.OPT_WRITEFUNCTION, cw);
cg.setopt(CURL.OPT_VERBOSE, 3);
cg.setopt(CURL.OPT_FOLLOWLOCATION,
1);
cg.setopt(CURL.OPT_SSL_VERIFYPEER,
0);
cg.setopt(CURL.OPT_SSL_VERIFYHOST,
0);
cg.setopt(CURL.OPT_SSLCERTTYPE,
"PEM");
cg.setopt(CURL.OPT_SSLVERSION, 3);
int result = cg.setopt(CURL.OPT_URL,
"https://www.mail.yahoo.com/");
// post method
cg.setopt(CURL.OPT_POST, 1);
// IS THIS THE RIGHT WAY TO SET SIMPLE POST DATA?
cg.setopt(CURL.OPT_POSTFIELDS, "some
post data");
// IS THIS THE RIGHT WAY TO SET COOKIE?
if(cookieString != null)
cg.setopt(OPT_COOKIE, cookieString);
cg.perform();
I would really appreciate some guidance here.
Thanks!
Qian
Received on 2005-02-22