Questions about curl content retrieval and simulated logon

Source: Internet
Author: User
Curl content retrieval and simulated logon & lt ;? Phpecho & nbsp; $ cookie_file = & nbsp; tempnam ('./tmp', 'cooker'); $ curl_login = "http://xiaoxin.duapp.com/wp-lo curl get content and simulate login problems

Echo $ cookie_file = tempnam ('./tmp', 'cooke ');
$ Curl_login = "http://xiaoxin.duapp.com/wp-login.php ";
$ Curl_logined = "http://xiaoxin.duapp.com/index.php ";
$ User = "##";
$ Pass = "##";
$ CurlPost = "log = $ user & pwd = $ pass ";
$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ curl_login );
Curl_setopt ($ ch, CURLOPT_HEADER, 0 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
Curl_setopt ($ ch, CURLOPT_POST, 1 );
Curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ curlPost );
Curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookie_file );
$ Data = curl_exec ($ ch );
Curl_close ($ ch );



$ Ch = curl_init ();
Curl_setopt ($ ch, CURLOPT_URL, $ curl_logined );
Curl_setopt ($ ch, CURLOPT_HEADER, 1 );
Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 0 );
Curl_setopt ($ ch, CURLCOOKIEFILE, $ cookie_file );

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

?>
Unable to display when setting $ curl_logined = "http://xiaoxin.duapp.com/index.php ";
Set $ curl_logined = "http://xiaoxin.duapp.com/"; to read normally
But failed to log on
Warning information
Warning: curl_setopt () [function. curl-setopt]: Invalid curl configuration option in C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs \ phpcurl. php on line 25

HTTP/1.1 200 OK X-Pingback: http://xiaoxin.duapp.com/xmlrpc.php Content-Type: text/html; charset = UTF-8 Date: Sat, 08 Dec 2012 08:48:24 GMT Server: BWS/1.0 Transfer-Encoding: chunked
Please advise me
------ Solution --------------------
Curl_setopt ($ ch, CURLCOOKIEFILE, $ cookie_file );
="
CURLOPT_COOKIEFILE

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.