php curl adds cookie to forge login and capture data

WBOY
Release: 2016-07-25 08:42:10
Original
919 people have browsed it
php, curl, cookie

Some web pages must be logged in to see. At this time, if you want to capture information, you must pass the cookie value in the header to obtain it


1. First log in to the website, open firebug and you will see the corresponding cookies. Copy these cookies and you can use them



2,

  1. header("Content-type:text/html;Charset=utf8");
  2. $ch =curl_init();
  3. curl_setopt($ch,CURLOPT_URL,'http: //www.babytree.com/user/picjournal.php');
  4. $header = array();
  5. //curl_setopt($ch,CURLOPT_POST,true);
  6. //curl_setopt($ch, CURLOPT_POSTFIELDS, $fields );
  7. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  8. curl_setopt($ch,CURLOPT_HEADER,true); 62.7 .1401937092035530; bdshare_firstime=1401937092199; __myutma=122328856.1548793539.1401937093.1408503164.1408694138.69;');
  9. $content = curl_ exec($ch);
  10. echo "
    ";print_r(curl_error($ch));echo "
    ";
  11. echo "
    ";print_r(curl_getinfo($ch));echo "
    ";
  12. echo "
    ";print_r($header); echo "
    ";
  13. echo "
    ",$content;
Copy code

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!