Quote:
Originally Posted by cbkihong
I received the following private message from you. As I mentioned in my reply message, let us make more contribution to the knowledge base by keeping technical discussions in the forums, so I give my response here.
Thank you cbkihong. Since I do not have access to install XML::XPath module on our system over here, I have decided to write a simple program which essentially does what you have provided in 4 or 5 lines. Here is the code for the same.
#! /usr/bin/perl
use LWP::UserAgent;
$ua = LWP::UserAgent->new;
$ua->agent("0/0.1 " . $ua->agent);
$Supplier = '201330-01';
$Plant = 'XXX';
$Contact = 'ABC';
$qry = 'http://nshamd02.ham.am.honda.com/servlet/eDCISSupplierServlet?Supplier=' . $Supplier . '&Plant=' . $Plant . '&Group=' . $Contact;
print "The query is \n";
print $qry . "\n";
$req = HTTP::Request->new(GET => "$qry");
$req->header('Accept' => 'text/xml');
$res = $ua->request($req);
if ($res->is_success) {
open(MAIL, ">.mail.tmp");
print MAIL $res->content;
close(MAIL);
open (FP, ".mail.tmp");
while (<FP>) {
if (/EMAIL/) {
$mail = $_;
$mail =~ s/EMAIL//g;
$mail =~ s/\<//g;
$mail =~ s/\>//g;
$mail =~ s/\///g;
$mail =~ s/^ //g;
$mail =~ s/ *//g;
print $mail;
}
}
unlink ".mail.tmp";
} else {
print "Error " . $res->status_line . "\n";
}
Jerardfjay