perl 自定义请求头
2015-12-10 18:02
471 查看
use LWP::UserAgent; $ua = LWP::UserAgent->new; @header = ( 'accept'=> "application/json", 'content-type'=> "application/json", 'apix-key'=> "e7b00871640c49567a37566ccd5c27e9", 'User-Agent' => "Mozilla/8.0" ); $start = $ARGV[0]; $end = $ARGV[1]; $date = $ARGV[2]; $host="http://a.apix.cn/apixlife/ticket/rest?from=$start&to=$end&date=$date"; $request = HTTP::Request->new(GET=>"$host"); $request->header(@header); $response = $ua->request($request); $content= $response->decoded_content; $content =~ s/\\u([0-9a-fA-F]{4})/pack("U",,hex($1))/eg; print "\$content is $content\n";
相关文章推荐
- Fragment管理工具实现Fragment之间切换
- 深入学习微框架:Spring Boot
- H264学习笔记(1):视频压缩编码的基本原理
- Spark SQL Catalyst源代码分析Optimizer
- javaee学习过程
- 【Html】水平居中总结-不定宽块状元素方法(三)
- java操作POI 错误 org.apache.xmlbeans.XmlOptions
- GCD--队列的类型和执行任务方式的四种的排列组合
- CSS3中新出现的技术
- Redis overcommit_memory参数说明:
- 黑马程序员——抽象类与接口
- 【Java】利用Gearman进行Mysql到Redis的复制
- Android ViewPager+HorizontalScrollView实现标题栏滑动(腾讯新闻)
- centos添加普通用户,操作权限设置
- Java文件操作(二)按照字符读写
- docker常用命令
- 可以用来练手的经典项目---列表
- 关于窗体的【杂记】
- 正在创造“情感计算”的微软小冰,或将开启未来计算新纪元
- 脚本工具