> > On Apr 2, 2015, at 11:03 AM, Hugo Escobar <[email protected]> wrote: > > Hi, > > I'm trying to write a scrip that sends a web request to an external server > and depending on the answer set a specific priority level > > So far the web request goes out and the priority can be set. The only > missing part is that I can't get a hold of the external web server response. >
Hi Hugo, Firstly - Does https://extwebserv/ have a real certificate? Try the following instead. I haven't tested it but basically it tries the URL and sets the priority if it was successful. It also logs the response message (a short human readable single line string that explains the response code) regardless of what it was. It returns whatever $status is (if it's set then it'll be non-zero). use LWP::UserAgent; my $url = 'https://extwebserv/'.somePieceOfData; RT::Logger->info("Ticket ".$self->TicketObj->id." Checking ".$url); my $ua = LWP::UserAgent->new; my $response = $ua->get($url); my ($status, $msg); # Set these up as empty for now ($status, $msg) = $self->TicketObj->SetPriority('100') if $response->is_success; RT::Logger->info("Ticket ".$self->TicketObj->id." ".$response->message); return $status; Landon Stewart : [email protected] Lead Specialist, Abuse and Security Management Spécialiste principal, gestion des abus et sécurité http://iweb.com : +1 (888) 909-4932
signature.asc
Description: Message signed with OpenPGP using GPGMail
