BarrettNetworks Posted November 5, 2011 Share Posted November 5, 2011 Hello All! We sell dedicated servers and for the most part they are built to order. Now we are getting to the point were we have servers sitting around that need to be sold. It is a pain to create a WHMCS product every time we take a server down or put one up because the specs change. So we have a perl script that reads the data simply from a txt file on the server and it displays the current servers on a web page. When the server is selected it sends the data to a php contact form. Then we send the customer a invoice threw WHMCS to pay later. Here is the script we used. Is there anyway we can send the data to WHMCS to create a product or a onetime invoice to include price and a quick description? #!/usr/local/bin/perl $bit=1; $sn=1; @sl=`cat /home/barrett/public_html/v5/data/servers.txt`; foreach $line (@sl) { chomp($line); $is="<li><b>Immediate Installation Available!</b></li>"; ($price,$desc) = split(/ - /,$line); if ($desc =~ m/premiere/i) {$is="";} ($proc, $ram, $drive, $trans, $trash) = split(/,/,$desc); if (! $trans) {$trans="3300GB";} $proc=~s/premiere //ig; $proc=~s/intel//ig; $image="images/processors/100px-Intel_Celeron_M_Logo.jpg"; if ($proc =~ m/P4/i) {$image="images/processors/100px-Intel_Pentium_4_Logo.jpg";} if ($proc =~ m/Dual Core/i) {$image="images/processors/100px-Intel_Pentium_D_Logo.jpg";} if ($proc =~ m/Core 2/i) {$image="images/processors/100px-Intel_Core_Duo_Logo.jpg";} if ($proc =~ m/Core Duo/i) {$image="images/processors/100px-Intel_Core_2_Duo_Logo.jpg";} if ($proc =~ m/Quad Core/i) {$image="images/processors/100px-Intel_Core_2_Quad_Logo.jpg";} if ($proc =~ m/Xeon/i) {$image="images/processors/100px-Intel_Xeon_Logo.jpg";} if ($proc =~ m/Athlon/i) {$image="images/processors/100px-AMD_Athlon_64_Logo.jpg";} if ($proc =~ m/X2/i) {$image="images/processors/100px-AMD_Athlon64_X2_Logo.jpg";} if ($proc =~ m/Opteron/i) {$image="images/processors/100px-AMD_Opteron_Logo.jpg";} if ($proc =~ m/i3/i) {$image="images/processors/i3.jpg";} if ($proc =~ m/i5/i) {$image="images/processors/i5.jpg";} if ($proc =~ m/i7/i) {$image="images/processors/i7.jpg";} if ($proc =~ m/phenom/i) {$image="images/processors/AMD_Phenom.jpg";} if ($proc =~ m/Q9/i) {$image="images/processors/100px-Intel_Core_2_Quad_Logo.jpg";} if ($proc =~ m/Q8/i) {$image="images/processors/100px-Intel_Core_2_Quad_Logo.jpg";} if ($proc =~ m/E5/i) {$image="images/processors/100px-Intel_Pentium_D_Logo.jpg";} if ($proc =~ m/E6/i) {$image="images/processors/100px-Intel_Pentium_D_Logo.jpg";} $line = <<END; <div class="round"> <div class="header"> <!-- Empty Div --> </div> <div class="spacer"> <table cellspacing="0" cellpadding="0" border="0" class="colo"><tr> <th><img src="<--image-->" alt="" /></th> <td class="second"><strong><--proc--></strong></td> <td><ul class="basic_list"> <li><--memory--> Memory</li> <li><--drive--> Hard Drive</li> <li><--band--> Bandwidth</li> <--install--> </ul></td> <td class="last"> <strong> <span class="dollars"><--price--></span> <form method="POST" action="dedicated-order.php"> <input type=hidden name=id value=0> <input type=hidden name=server value=<--server-->> <input type=submit value="Order"> </form></td></tr> </table> </div> <div class="footer"> <!-- Empty Div --> </div> </div> END $line =~ s/<--image-->/$image/g; $line =~ s/<--proc-->/$proc/g; $line =~ s/<--memory-->/$ram/g; $line =~ s/<--drive-->/$drive/g; $line =~ s/<--band-->/$trans/g; ($dol,$cen)=split(/\./,$price); $dol = '$' . substr($dol,1) * 1.25; $line =~ s/<--price-->/$dol/g; $line =~ s/<--server-->/$sn/g; $line =~ s/<--install-->/$is/g; print $line; # print "<td class=\"first\"><img src=\"$image\" alt=\"Icon\" /><strong> $proc</td> \n"; # print "<td><strong>$ram</td> \n"; # print "<td><strong>$drive</td> \n"; # print "<td><strong>$trans</td> \n"; # print "<td><strong>$is</td> \n"; # ($dol,$cen)=split(/\./,$price); # print "<td class=\"last\"><strong> <strong><span class=\"dollars\">$dol</span>"; # print "<span class=\"cents\">.95 /Mo. </span></strong></center></td> \n"; # print "<td class=\"last\">"; # print "<form method=\"POST\" action=\"dedicated-order.php\">"; # print "<input type=hidden name=server value=$sn>"; # print "<input type=image src=\"/images/order_now.gif\" value=\"Order\">"; # print "</form></td> \n"; # print "</tr> \n"; $bit++;$sn++; if ($bit > 1) {$bit=0;} } Thanks!!! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.