perl 自动发产品
use Net::SMTP;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Response;
use Encode;
use Switch;
use File::Temp qw/tempfile/;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);
my $CurrTime = time2iso( time() );
my $dis_mainpublish = '中均资本';
my $ua = LWP::UserAgent->new( ssl_opts => {verify_hostname => 0});
$ua->timeout(10);
$ua->env_proxy;
my $now = time();
$ua->agent('Mozilla/5.0');
my $cookie_jar = HTTP::Cookies->new(
file => 'lwp_cookies.txt',
autosave => 1,
ignore_discard => 1
);
$ua->cookie_jar($cookie_jar);
my $str = ( rand(1) );
##获取验证码https://www.zjtest4.com/validcode/generate-validcode.do
my $response =
$ua->get("https://www.zjtest4.com/validcode/generate-validcode.do?$str");
print "\$str is $str\n"; if ( $response->is_success ) {
$r = $response->decoded_content; # print $response->decoded_content; # or whatever
}
else {
die $response->status_line;
} my ( $fh, $filename ) =
tempfile( "wj_qrcode_XXXX", SUFFIX => ".jpg", DIR => 'c:\\' );
binmode $fh;
print $fh $r;
close $fh;
print encode( "gbk", decode( "utf8","登录二维码已经下载到本地")) ."[ $filename ] \n"; ##打开图片
system("start $filename "); my $validCode = <STDIN>;
chomp $validCode;
print "\$validCode is $validCode\n"; #my $url="https://www.zjtest4.com/business/dispatch_post.do"; my $login_url = 'https://www.zjtest4.com/business/dispatch_post.do?action=submitAdminLogin'; my $res = $ua->post(
$login_url,
{ 'userName' => 'w123456',
'userPass1' => 'w123456',
'userPass' => '3d24b838770ee90773804e8599e549ff',
'validCode' => "$validCode"
}
);
my $head = $res->header('Location');
#print $res->header('Location');
print $res->status_line . "\n";
#print $res->as_string()
; #获取的是原始内容,包括响应头,响应正文
my $content = $res->content(); my $response = $ua->get("$head");
if ( $response->is_success ) {
#print $response->content;
$r = $response->content;
my $str = encode( "gbk", decode( "utf8", "$r" ) );
print "\login_info is $str\n"; }
else {
$r = $response->content;
print $response->content;
} ###调用发布产品接口
my $url="https://www.zjtest4.com/web/adminauth/post";
my $res = $ua->post(
$url,
{ 'accessType' => '1',
'addUnit' => '1000',
'assignType' => '1',
'bonus' => "0",
'bonusName' => "请选择红包类型",
'borrowerInfo' => "scan",
'buyAcctTypes' => "1",
'buyFromTime' => "2016-07-27 12:01",
'buyToTime' => "2016-07-28 23:59:59",
'capitalPurpose' => "",
'compound' => "2",
'contractSn' => "340",
'custody' => "scan",
'daysOfYear' => "360",
'delegator' => "3",
'duration' => "3",
'entryUnit' => "1000",
'expirationDate' => "2015-1-31",
'financeType' => "1",
'initSoldQuota' => "1000",
'entryUnit' => "0",
'isOnlyForFirst' => "1",
'manualSn' => "0",
'maxClient' => "0",
'maxUnit' => "10000",
'maxYield' => "0.03",
'method' => "/admin/product/publish",
'name' => "温金宝-987654321",
'entryUnit' => "1000",
'entryUnit' => "1000",
'entryUnit' => "1000",
'entryUnit' => "1000",
'entryUnit' => "1000",
'entryUnit' => "1000",
'entryUnit' => "1000",
'entryUnit' => "1000",
'entryUnit' => "1000",
'naturalSeasonRepaymentDay'=>'1',
'precision'=>'2',
'productId'=>'99999999',
'productIntro'=>'scan',
'productPublishType'=>'2',
'productType'=>'4',
'publishChannel'=>'3001',
'quotaForFirst'=>'100000',
'recommendDate'=>'2016-07-27',
'repaySource'=>'scan',
'riskInfo'=>'scan',
'riskLevel'=>'1',
'safeguard'=>'1',
'settlementDate'=>'2016-08-01',
'stageNum'=>'1',
'stagingTemplateId'=>'',
'stairYieldSn'=>'',
'stockAwardYield'=>'0',
'supportCouponType'=>'2',
'supportStock'=>'2',
'supportTransfer'=>'2',
'totalQuota'=>'100000000',
'unitValue'=>'1',
'valueEndDate'=>'2016-07-31',
'valueStartDate'=>'2016-07-29',
'wzeCardYield'=>'0',
'wzeCardYieldOnOff'=>'2',
'yield'=>'0.02',
'yieldForFirst'=>'0.01' }, 'User-Agent'=>'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0' );
print $res->header('Location');
print $res->status_line."\n";
my $str= $res->as_string();#获取的是原始内容,包括响应头,响应正文
perl 自动发产品的更多相关文章
- PHP自动发邮件
自动发邮件 使用了这个类http://bbs.php100.com/read-htm-tid-121431.html 因他用的php版本较老,用到了函数ereg_replace() 和 ereg() ...
- C蛮的全栈之路-node篇(二) 实战一:自动发博客
目录 C蛮的全栈之路-序章 技术栈选择与全栈工程师C蛮的全栈之路-node篇(一) 环境布置C蛮的全栈之路-node篇(二) 实战一:自动发博客 ---------------- 我是分割线 ---- ...
- QQ空间自动发广告解决方法
最近空间好多人QQ都中了毒.每天我都有几十个好友刷空间话费.流量广告! QQ空间自动发广告的原因: 最近使用了刷赞或者其他QQ外挂软件(有些开发者或破解者会在这样的软件上留后门,请自己判断). 或者最 ...
- python自动发邮件库yagmail
#### 一般发邮件方法 我以前在通过Python实现自动化邮件功能的时候是这样的: import smtplib from email.mime.text import MIMEText from ...
- java windows自动化-mail自动发邮件
本文旨在让测试人员了解如何发邮件 发邮件的话,最简单的事是直接手动发邮件,但是在自动化测试中,应做到让机器或者代码来自动发送邮件,笔者大概了解以下几种方法,总有一款口味适合你:1java代码来做下面即 ...
- python自动发邮件
from email.header import Header from email.mime.text import MIMEText from email.utils import parsead ...
- jira6.3.6创建问题不自动发邮件通知的问题
装完jira6.3.6后,设置好邮件服务器,测试没有问题.但是创建问题不自动发邮件提示用户.折腾了大半天,请教了一位大神,终于搞定.步骤是: agile->系统->用户界面->用户缺 ...
- redmine创建新闻,自动发邮件给项目组所有成员
redmine创建新闻,自动发邮件给项目组所有成员: 1.添加用户至公共项目内 2.配置系统邮件推送配置 3.检查用户接受推送配置 3.使用管理员账户发布新闻(不能自己发送自己) 4.查看邮件接受邮件
- python自动发邮件库yagmail(转)
一般发邮件方法 我以前在通过Python实现自动化邮件功能的时候是这样的: import smtplib from email.mime.text import MIMEText from email ...
随机推荐
- hive原生和复合类型的数据载入和使用
原生类型 原生类型包含TINYINT,SMALLINT,INT,BIGINT,BOOLEAN,FLOAT,DOUBLE,STRING,BINARY (Hive 0.8.0以上才可用),TIMESTAM ...
- 纯代码 自己主动屏幕适配iPhone button
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY2h1bmdlc2hpaHVhdGlhbg==/font/5a6L5L2T/fontsize/400/fil ...
- Glog
Glog的简单入门,glog虽然在配置参数方面比较麻烦,但是在小规模程序中,由于其简单灵活,也许会有优势. 0, glog 是google的开源日志系统,相比较log4系列的日志系统,它更加轻巧灵活 ...
- API和DLL
API API(Application Programming Interface,应用编程接口)其实就是操作系统留给应用程序的一个调用接口,应用程序通过调用操作系统的 API 而使操作系统去执行应用 ...
- hdu 2203亲和串 (kmp)
#include<cstdio>#include<iostream>#include<cstring>#include<string>using nam ...
- zoj 3490
蛋都疼了,高了半天,Output Limit Exceeded 原来是输入的问题,我靠!!以后还是用输入输出c++好,这尼玛!!郁闷!!!!! #include<stdio.h> #inc ...
- Java 比较两日期相差天数
(版本1) publicstaticint getIntervalDays(Date fDate, Date oDate) { if (null == fDate || null == oDate) ...
- 0603 python 基础02
作业1:ANSI和utf8的区别? ASCII是用来表示英文字符的一种编码规范,每个ASCII字符占用1个字节(8bits). 可以表示的最大字符数是256,一般只用前128个(最高位为0),其中包括 ...
- (Problem 46)Goldbach's other conjecture
It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a ...
- IOS本地化。
1,项目名本地化 点击项目,蓝色图标->info 最下面+号,添加chinese本地化. Supporting Files->infoPlist.strings 下会有两个文件,有一个是设 ...