- 论坛徽章:
- 0
|
use utf8;
use WWW::Mechanize;
use Encode;
$url="http://bbs.sh.libaclub.com/message.php?action=write";
$mech=WWW::Mechanize->new();
$mech->agent_alias('Windows IE 6');
$mech->add_header(Referer=>'http://xxx/message.php');
$mech->add_header(Accept-Charset=>'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
$mech->add_header(Accept-Language=>'en-us,en;q=0.5');
$mech->add_header(Cookie=>'sxxxxxxx7516; __utmc=87665927; __utmz=87665927.1283527516.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); mytopictabs=0; PHPSESSID=0d0cf34ebcdeec3936cd1831ca68b6ca');
$mech->get($url);
$mech->form_name("form1");
$mech->field("receiverName","xxx");
my $subject="测试";
$subject=encode('gbk',$subject);
$mech->field("topic",$subject);
my $content="明月几时有,把酒问清天,不知天上宫阙,今夕是何年!";
$content=encode('gbk',$content);
$mech->field("content",$content);
$mech->submit();
网页编码为gbk,我在提交之前也转为gbk编码了,但是提交后,subject标题字段和content内容字段都显示为乱码,在cpan上查了也没看到相应的解决办法,只好来这里求救兵了,有知道的请出手,谢谢了! |
|