1 packages FS::part_export::http_status;
2 use base qw( FS::part_export );
7 use HTTP::Request::Common;
9 tie my %options, 'Tie::IxHash',
10 'url' => { label => 'URL', },
11 #'user' => { label => 'Username', default=>'' },
12 #'password' => { label => 'Password', default => '' },
17 'desc' => 'Retrieve status information via HTTP or HTTPS',
18 'options' => \%options,
20 Fields from the service can be substituted in the URL as $field.
24 sub rebless { shift; }
26 sub export_getstatus {
27 my( $self, $svc_x, $htmlref, $hashref ) = @_;
29 my $url = $self->option('url');
32 ${$_} = $svc_x->getfield($x) foreach $svc_x->fields;
34 $url = eval(qq($url));
37 my $req = HTTP::Request::Common::GET( $url );
38 my $ua = LWP::UserAgent->new;
39 my $response = $ua->request($req);
41 $$htmlref = $response->is_error ? $response->error_as_HTML
45 #hash data note yet implemented for this status export