perl post 参数+发送json数据

my     $login_url =  
"https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxinit?r=-$now&lang=zh_CN&pass_ticket=$pass_ticket";  
    my $post = {  
        BaseRequest => {  
            Uin      => $wxuin,  
            Sid      => $wxsid,  
            Skey     => $Skey,  
            DeviceID => $DeviceID,  
        }  
    };  
    use JSON qw(encode_json);  
    $json_string = encode_json($post);  
  
    my $req = HTTP::Request->new(  
        'POST' => $login_url,  
        [ 'r' => "-$now", 'lang' => 'zh_CN', 'pass_ticket' => "$pass_ticket" ]  
    );  
    $req->referer("https://wx.qq.com/?&lang=zh_CN");  
    $req->content_type('application/json; charset=UTF-8')  
      ;    #post请求,如果有发送参数,必须要有这句  
    $req->content("$json_string");    #发送post的参数  
    my $res = $ua->request($req); 

原文地址:https://www.cnblogs.com/hzcya1995/p/13349196.html