use strict; use LWP::UserAgent; use HTTP::Request::Common; my $connId; # The xml_request my $xml_req = '<?xml version="1.0" encoding ="UTF-8"?><!DOCTYPE dr +l SYSTEM "http://172.XX.XXX.XXX:40500/lab/v1/api/connectionRequest.dt +d" ><drl mode="normal" connectionid="null"><openconnection username=" +admin" password="admin"/></drl>'; my $ua = LWP::UserAgent->new(); my $response = $ua->post("http://172.XX.XXX.XXX:40500/xmlApiServle +t", Content => $xml_req); if ($response->is_success) { print $response->decoded_content; $response->decoded_content =~ m/drl connectionid\=\"(.*?)\".*?\>/; $connId = $1; } else { die $response->status_line; }
The $connId contains the id but is there any way to use another Perl module and directly fetch the value instead using regular expression.if so please explain ,how? Thanks in advance. -PK
In reply to How to fetch the value using LWP:: UserAgent by panapka
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |