perl lwp get uft-8和gbk
2016-04-01 18:10
204 查看
gbk编码: jrhmpt01:/root/lwp# cat x2.pl use LWP::UserAgent; use DBI; $user="root"; $passwd='R00t,uHagt.0511'; $dbh=""; $dbh = DBI->connect("dbi:mysql:database=zjzc_vote;host=114.55.5.57;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr; $dbh->do("SET NAMES utf8"); use POSIX; use Data::Dumper; use HTML::TreeBuilder; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; $ua->agent("Mozilla/8.0"); my $response = $ua->get('http://data.10jqka.com.cn/financial/yjyg/date/2016-03-31/ajax/1/'); if ($response->is_success) { print $response->content; }; jrhmpt01:/root/lwp# echo $LANG en_US utf8编码: jrhmpt01:/root/lwp# echo $LANG en_US.UTF-8 jrhmpt01:/root/lwp# cat x2.pl use LWP::UserAgent; use DBI; $user="root"; $passwd='R00t,uHagt.0511'; $dbh=""; $dbh = DBI->connect("dbi:mysql:database=zjzc_vote;host=114.55.5.57;port=3306",$user,$passwd) or die "can't connect to database ". DBI-errstr; $dbh->do("SET NAMES utf8"); use POSIX; use Data::Dumper; use HTML::TreeBuilder; my $ua = LWP::UserAgent->new; $ua->timeout(10); $ua->env_proxy; $ua->agent("Mozilla/8.0"); my $response = $ua->get('http://data.10jqka.com.cn/financial/yjyg/date/2016-03-31/ajax/1/'); if ($response->is_success) { print $response->decoded_content;; };
相关文章推荐
- perl lwp get uft-8和gbk
- CGA:自动判断模型间关系的3D建模方法
- 前端学习: CSS学习
- Linux磁盘修复e2fsck命令
- HTTP抓包的实践--工具
- PHP文件上传处理
- kernel 3.10内核源码分析--中断--中断和异常返回流程
- uva1629Cake slicing
- FZU 2123 数字的孔数
- linux kernel ,Linux内核的吸引力
- webService——wsdl文件生成java代码
- windows server 2003 php 环境搭建 MYSQL错误1067
- 基于AFNetworking3.0网络封装
- I Hate It
- NGX学习: ngx_event事件机制
- something behind kmalloc
- java swing 中的列表框JList如何在程序中动态的添加和删除元素
- Android_新建animation动画res/anim目录
- maven修改目录
- Qt操作SQLite数据库——创建、打开、关闭、增加、删除和修改操作