1. 程式人生 > >perl post 請求相關引數

perl post 請求相關引數

    $ua->post( $url, \%form )
    $ua->post( $url, \@form )
    $ua->post( $url, \%form, $field_name => $value, ... )
    $ua->post( $url, $field_name => $value,... Content => \%form )
    $ua->post( $url, $field_name => $value,... Content => \@form )
    $ua->post( $url, $field_name => $value,... Content => $content )
        This method will dispatch a "POST" request on the given $url, with
        %form or @form providing the key/value pairs for the fill-in form
        content. Additional headers and content options are the same as for
        the get() method.
		
		
		這個方法會呼叫一個POST 請求在給定的$url上,使用%form 或者@form 提供鍵值對 對於填充內容,
		
		額外的 headers 和記憶體選項是和get()方法一樣
		第一個引數是登陸的地址,第二個引數是一個匿名hash,第三個引數是請求頭
		   my $url='https://wenjinbao.winfae.com/business/dispatch_post.do?action=submitAdminLogin';
   my $res = $ua->post($url,{
	                         'userName'=>'IT_public',
							 #'userName'=>'ITxxxx',
                             'userPass'=>'xxx',
						     'userPass1'=>'xx',
                            'validCode'=> "$validCode"
                                                  },
				'User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0',
                 'Host'=>'wenjinbao.winfae.com',
                 'Referer'=>'https://wenjinbao.winfae.com/backoffice/login.html'				
				
										);