[rt-users] web request from custom scrip

Landon Stewart lstewart at iweb.com
Thu Apr 2 14:55:27 EDT 2015

> On Apr 2, 2015, at 11:03 AM, Hugo Escobar <hescobar at afslc.com> 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 : lstewart at iweb.com
Lead Specialist, Abuse and Security Management
Spécialiste principal, gestion des abus et sécurité
http://iweb.com : +1 (888) 909-4932

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150402/a7249848/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150402/a7249848/attachment.sig>

More information about the rt-users mailing list