#!/usr/bin/perl
#!c:\perl\bin\perl.exe

use LWP::Simple;
use Net::SSLeay;

#Please visit http://symlabs.com/Net_SSLeay/ 
#to download SSLeay and get more information on SSLeay
#Example:
#print Net::SSLeay::get_https("lizzie.uccs.edu", 443, "/cgi-bin/purchase.pl");

$xmldoc = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>
 <purchase>
  <customerName>CCL</customerName>
  <customerID>111222333</customerID>
  <item>
     <productID>309121541416</productID>
     <productName>IBM Thinkpad T21</productName>
     <unitPrice>5000</unitPrice>
     <noOfUnits>10</noOfUnits>
     <subTotal>506</subTotal>
  </item>
  <item>
     <productID>309121541481</productID>
     <productName>IBM Thinkpad T21</productName>
     <unitPrice>5000</unitPrice>
     <noOfUnits>10</noOfUnits>
     <subTotal>50081</subTotal>
  </item>";

$xmlend="
  <totalAmount>52000</totalAmount>
</purchase>";

for ($i=1; $i<=100; $i++) {
  $xmladd="
  <item>
     <productID>".$i."3121541476</productID>
     <productName>IBM Thinkpad T21".$i."</productName>
     <unitPrice>".$i."50</unitPrice>
     <noOfUnits>".$i."10</noOfUnits>
     <subTotal>".$i."577</subTotal>
  </item>";

  $xmlmid=$xmlmid.$xmladd;
}

$xmldoc=$xmldoc.$xmlmid.$xmlend;

$time3=time;

for ($i=1; $i<=30; $i++) {
 ($page, $response, $server_cert)
    = Net::SSLeay::post_https('lizzie.uccs.edu', 443, '/cgi-bin/purchase.pl','', 
#   = Net::SSLeay::post_https('calvin.uccs.edu', 443, '/cgi-bin/purchase.pl','',     
      Net::SSLeay::make_form('xmlpurchase' => $xmldoc));
 print "--------";
 print $response;
 print "--------\n";
 print $page;
 print "\n";
# print $xmldoc;
}

$time4=time;
$periodxml = ($time4 -$time3)/30;
$len = length($xmldoc);
print "XML file length is $len \n";
print "Get response after submitting purchase.xml in $periodxml seconds\n";

