嗨我正在制作一个打开网页的小程序这个网页需要收到我的msisdn才能让我收到登录,我试图通过这种方式发送
#!/usr/bin/perl
use WWW::Mechanize;
my $target = "http://www.example.domain/subscription/showsubscribe";
my $user_agent = 'Mozilla/5.0 (Linux; Android 4.2.2; es-us; SAMSUNG GT-I9195L Build/JDQ39) AppleWebKit/535.19 (KHTML, like Gecko) Version/1.0 Chrome/18.0.1025.308 Mobile Safari/535.19';
my $phonenumber = 'XXXXXXXXXX';
my $mech = WWW::Mechanize->new(agent=>$user_agent);
$mech->add_header('x-msisdn'=> $phonenumber);
my $response = $mech->get($target);
die "Error at '$target'\n", $response->status_line, "\n
Aborting" unless $response->is_success;
print $mech->content;
$response = $mech->response;
for my $key ($response->header_field_names()) {
print "response[$key] = ", $response->header($key), "\n";
我在本页面的论坛中阅读了X-msisdn变量:http://mobiforge.com/design-development/useful-x-headers
关于如何发送HTTP标头的任何想法?
提前感谢!
答案 0 :(得分:0)
... $ mech-> add_header(' x-msisdn' => $ phonenumber);
关于如何发送HTTP标头的任何想法?
标题被发送(使用wireshark或类似方法检查)。 你的问题有所不同。