<?php //1:curl初始化  $ch = curl_init(); //2:设置post数据  $data = array ( 'post_xuehao' => '13110572068' ); //3:设置请求的url curl_setopt($ch, CURLOPT_URL, "http://210.44.176.116/cjcx/xhcx_list.php"); //4:设置请求的参数 curl_setopt ( $ch, CURLOPT_POST, 1 ); curl_setopt ( $ch, CURLOPT_HEADER, 0 ); curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data ); //保存到文件,以注释 // $fop=fopen("test.html", "wr"); // if(!$fop){ // mkdir("test.html","wr"); // } // curl_setopt($ch, CURLOPT_FILE,$fop); //5:执行url,返回结果 $re=curl_exec($ch); //6:打印到浏览器 echo $re; //关闭curl curl_close($ch); // fclose($fop); ?>
The above introduces the use of PHP's curl to crawl the information after login, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.