Php uses curl to simulate a simple instance for logon to Renren (on-campus). curl _ PHP Tutorial on campus

Source: Internet
Author: User
Php uses curl to simulate a simple instance for logging on to the Renren (on-campus) network. Php uses curl to simulate logon to a simple instance of Renren (on-campus) network, and curl uses curl to simulate logon to a simple instance of Renren (on-campus) network $ login_urlpassport.renren.comPLogin.d php uses curl) simple instance of the network, curl on campus

Php uses curl to simulate a simple instance for logon to Renren (on-campus ).

$ Login_url =' http://passport.renren.com/PLogin.do '; $ Post_fields ['email'] = 'xxxx'; $ post_fields ['password'] = 'xxxx '; $ post_fields ['url url'] = 'http % 3A % 2F % 2Fhome.renren.com % 2FHome. do '; $ post_fields ['domain'] = 'renren. com '; // The cookie file is stored in the temp folder of the website root directory $ cookie_file = tempnam ('. /temp ', 'cookies'); $ ch = curl_init ($ login_url); curl_setopt ($ ch, CURLOPT_USERAGENT, 'mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv: 1.9.1.5) Gecko/20091102 Firefox/3.5.5 '); curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ($ ch, batch, 1); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ ch, CURLOPT_AUTOREFERER, 1); curl_setopt ($ ch, CURLOPT_POST, 1 ); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post_fields); curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookie_file); curl_exec ($ ch); curl_close ($ ch); // Carries the cookie file, visit Renren homepage $ send_url =' http://home.renren.com/Home.do '; $ Ch = curl_init ($ send_url); curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ cookie_file); $ contents = curl_exec ($ ch); curl_close ($ ch); // clear the cookie file unlink ($ cookie_file ); // output the content of the Renren homepage print_r ($ contents );

The above php simple example of using curl to simulate login to Renren (on-campus) network is all the content shared by Xiaobian. I hope to give you a reference, and I hope you can also provide more support for helping customers.

Http://www.bkjia.com/PHPjc/1135018.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1135018.htmlTechArticlephp uses curl to simulate a simple instance of login to everyone (on campus) network, curl campus php uses curl to simulate a simple instance of login to everyone (on campus) network $ login_url = 'http: // passport.renren.com/PLogin.d...

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.