Home  >  Article  >  Backend Development  >  php curl adds cookie to forge login and capture data

php curl adds cookie to forge login and capture data

WBOY
WBOYOriginal
2016-07-25 08:42:10962browse
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

Statement:
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
Previous article:php determines access IPNext article:php determines access IP