jrhmpt01:/root# cat -n hcp.pl
1 use LWP::UserAgent;
2 use Encode;
3 $ua = LWP::UserAgent->new;
4 @header = (
5 'accept'=> "application/json",
6 'content-type'=> "application/json",
7 'apix-key'=> "e7b00871640c49567a37566ccd5c27e9",
8 'User-Agent' => "Mozilla/8.0"
9 );
10
11 $start = $ARGV[0];
12 $end = $ARGV[1];
13 $date = $ARGV[2];
14 $host="http://a.apix.cn/apixlife/ticket/rest?from=$start&to=$end&date=$date";
15 $request = HTTP::Request->new(GET=>"$host");
16 $request->header(@header);
17
18 $response = $ua->request($request);
19 $content= $response->decoded_content;
20 $content =~ s/\\u([0-9a-fA-F]{4})/pack("U",,hex($1))/eg;
21 print $content."\n";;
22 print "-----------------------\n";
23 print encode_utf8($content);
24 print "\n";
jrhmpt01:/root# perl hcp.pl BJP TJP 2015-12-11
Wide character in print at hcp.pl line 21.
{"status": true, "validateMessagesShowId": "_validatorMessage", "messages": [], "httpstatus": 200, "validateMessages": {}, "data": {"message": "没有符合条件的数据!", "flag": false}}
-----------------------
{"status": true, "validateMessagesShowId": "_validatorMessage", "messages": [], "httpstatus": 200, "validateMessages": {}, "data": {"message": "没有符合条件的数据!", "flag": false}}