1 package FS::part_export::http_status;
2 use base qw( FS::part_export );
8 use HTTP::Request::Common;
10 tie my %options, 'Tie::IxHash',
11 'url' => { label => 'URL', },
12 #'user' => { label => 'Username', default=>'' },
13 #'password' => { label => 'Password', default => '' },
18 'desc' => 'Retrieve status information via HTTP or HTTPS',
19 'options' => \%options,
21 Fields from the service can be substituted in the URL as $field.
25 sub rebless { shift; }
27 sub export_getstatus {
28 my( $self, $svc_x, $htmlref, $hashref ) = @_;
31 my $urlopt = $self->option('url');
35 ${$_} = $svc_x->getfield($_) foreach $svc_x->fields;
37 $url = eval(qq("$urlopt"));
40 my $req = HTTP::Request::Common::GET( $url );
41 my $ua = LWP::UserAgent->new;
42 my $response = $ua->request($req);
44 $$htmlref = $response->is_error ? $response->error_as_HTML
47 #hash data note yet implemented for this status export