Questions about curl simulated login

Source: Internet
Author: User
Curl simulated login question this post was last edited by zkg510168343 at 2013-10-22:29:21 & lt ;? Php $ url & nbsp; = & nbsp; "http://bbs.lampbrother.net/login.php"; $ ur curl simulated login problem
This post was last edited by zkg510168343 at 15:29:21, January 22 ,. $ Url = "http://bbs.lampbrother.net/login.php ";
$ Urls = "http://bbs.lampbrother.net ";
$ Lgt = 0;
$ User = "zkg12345 ";
$ Pass = "123456 ";
$ Question = 0;
$ Hideid = 1;

$ Temp = tempnam ('./tep', 'cookies ');

$ Postdata = "forward = & jumpurl = ". $ urls. "& step = 2 & lgt = ". $ lgt. "& pwuser = ". $ user. "& pwpwd = ". $ pass. "& question = ". $ question. "& answer = & hideid = ". $ hideid. "& cktime = ";
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ url );
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ postdata );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ temp );


$ Data = curl_exec ($ ch );
Curl_close ($ ch );

// Echo $ data; // you can see that the login is successful and the jump is being made.
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, 'http: // bbs.lampbrother.net/index.php ');
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 0 );
Curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ temp );

Curl_exec ($ ch );
Curl_close ($ ch );
?>

After the login is complete, I found that the login was successful when printing, and the page is displayed as a jump, but again requested the home page is still not logged on, other pages are not logged on, what is the problem and how to debug it?

A coo810B. tmp file is generated in the temporary cookie file.
The value is
# Netscape HTTP Cookie File
# Http://curlm.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

. Lampbrother. netTRUE/false14139616484f62d_c_stamp1321325648
. Lampbrother. netTRUE/FALSE13508896474f62d_lastvisitdeleted
. Lampbrother. netTRUE/FALSE14139616484f62d_lastposother
. Lampbrother. netTRUE/FALSE13508896474f62d_cideleted
. Lampbrother. netTRUE/FALSE14139616484f62d_ck_info % 2F % 09.lampbrother.net
. Lampbrother. netTRUE/FALSE13508896474f62d_regactivatedeleted
Share:
------ Solution --------------------
Full path!
$ Temp = realpath (tempnam ('./tep', 'cookies '));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.