Php uses curl to add cookie forgery to log on to capture data. curlcookie_PHP tutorial

Source: Internet
Author: User
Php uses curl to add a cookie to forge the method for logging in and capturing data, curlcookie. Php uses curl to add a cookie to forge the login and capture data. curlcookie this article describes how php uses curl to add a cookie to forge the login and capture data. We will share with you how php uses curl to add cookies to forge login and capture data. curlcookie

This example describes how php uses curl to add cookies to forge login and capture data. We will share this with you for your reference. The details are as follows:

Some web pages can be viewed only when they are logged on. in this case, the cookie value must be passed in the header to capture information.

1. first, log on to the website, open firebug, and you will see the corresponding cookies. copy these cookies and you will be able to use them.

2,

<?phpheader("Content-type:text/html;Charset=utf8");$ch =curl_init();curl_setopt($ch,CURLOPT_URL,'http://www.babytree.com/user/picjournal.php');$header = array();//curl_setopt($ch,CURLOPT_POST,true);//curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);curl_setopt($ch,CURLOPT_HEADER,true);curl_setopt($ch,CURLOPT_HTTPHEADER,$header);curl_setopt($ch,CURLOPT_COOKIE,'B=115.100.62.7.1401937092035530; bdshare_firstime=1401937092199; __myutma=122328856.1548793539.1401937093.1408503164.1408694138.69;');$content = curl_exec($ch);echo "
";print_r(curl_error($ch));echo "
";echo "
";print_r(curl_getinfo($ch));echo "
";echo "
";print_r($header);echo "
";echo "
",$content;

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.