curl采集登陆后的界面 若文件压缩,则解压文件
来源:互联网 发布:对于网络诈骗如何处理 编辑:程序博客网 时间:2024/06/05 09:54
function curl_post($url,$data,$method,$setcookie=false,$cookie_file=false){$ch = curl_init();curl_setopt($ch, CURLOPT_URL,$url);curl_setopt($ch,CURLOPT_CUSTOMREQUEST,$method);curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);//httpscurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1");curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);curl_setopt($ch,CURLOPT_AUTOREFERER,1);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //设定是否显示头信息curl_setopt($ch, CURLOPT_HTTPHEADER,array('Accept-Encoding: gzip, deflate'));//gzip解压内容 curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');if($method=='POST'){curl_setopt($ch,CURLOPT_POSTFIELDS,$data);}if($setcookie){curl_setopt($ch,CURLOPT_COOKIEJAR,$cookie_file);// setcookie('cookie_jar', $cookie_file); //保存cookie路径}else{curl_setopt($ch,CURLOPT_COOKIEFILE,$cookie_file);}$result = curl_exec($ch);curl_close($ch);if ($result == NULL) {return 0;}return $result;}$cookie_file=tempnam('./temp', 'cookie');$url="登陆后处理界面";$data=array('username'=>'***','password'=>'***');curl_post($url,$data,'POST',true,$cookie_file);$url1="登陆后显示界面";$html1=curl_post($url1,$data,'GET',false,$cookie_file);echo $html1;
0 0
- curl采集登陆后的界面 若文件压缩,则解压文件
- curl采集登陆后的界面
- 文件的压缩和解压
- 文件的压缩与解压
- 文件的压缩与解压
- 《文件的压缩与解压》
- 文件的压缩和解压
- 文件的压缩与解压
- 文件的压缩与解压
- 文件的压缩与解压
- 压缩与解压2---文件的压缩
- 解压多个压缩包时,解压后文件被放置在一个文件下的处理
- 文件压缩与解压
- linux压缩解压文件
- 压缩和解压文件
- c# 压缩解压文件
- C# 压缩解压文件
- 文件压缩和解压
- 337. House Robber III
- const的用法,特别是用在函数后面
- 关于opengl中glColor3f的应用
- 音频参数解析
- 学习大数据第一天:IPython安装
- curl采集登陆后的界面 若文件压缩,则解压文件
- 迷宫-BFS
- REF游标
- [Android 硬件] Eclipse错误:Conversion to Dalvik format failed with error 1
- 从空项目建立MFC工程
- 【字符串】POJ1271乒乓球
- SQL HAVING 子句
- CentOS7.1上安装Apache + SVN
- Xcode7.2 测试iOS9.3