HTTP标头的Perl程序和逗号分隔文件的输出文件

时间:2013-06-26 04:34:41

标签: perl automation

HTTP头的Perl程序.Below是HTTP heade的代码,输出文件是文本,但我需要一个逗号分隔的文件。

use strict; 
use LWP::simple;
use LWP::UserAgent; 
use HTTP::Request;  

my $URL = 'https://www.gmail.com/';  

my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 });  
my $header = HTTP::Request->new(GET => $URL);  
my $request = HTTP::Request->new('GET', $URL, $header);  
my $response = $ua->request($request);  

print "URL:$URL\nHeaders:\n";
print $response->headers_as_string;  
open (FILE, ">output.txt");
print FILE "URL:$URL\nHeaders:\n";  
print FILE $response->headers_as_string;
close(FILE);

0 个答案:

没有答案