my $xml = <<"GENERATE_XML"; < gestddatainput > < course >BE< /Course > < stdname >TestStudent< /StdName > < coursefee >350000< /CourseFee > < /GeStdDataInput > GENERATE_XML my $length = length($xml); my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout =>45); my $req = HTTP::Request->new(POST =>'http://studentrecords.com/getStduentData'); $req->content($xml); $req->header('Connection' => 'close', 'Content-length' => $length,'Content-Type'=>'text/xml', charset=>'utf-8'); my $res = $ua->request($req); my $response_data = $res->content; my $ref; eval { $ref = new XML::Smart($response_data); }; if($@){ print STDERR "\n------- Student Response START----------"; print STDERR "\n". $response_data; print STDERR "\n". $@; print STDERR "\n------- Student Response END----------"; return ""; } <.pre>
Comments
Post a Comment